CodeIgniter Forums
Error loging class - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Error loging class (/showthread.php?tid=30975)



Error loging class - El Forum - 06-02-2010

[eluser]ELRafael[/eluser]
My contrib for this class

./system/libraries/Log.php (L:102)
Code:
//$message .= $level.' '.(($level == 'INFO') ? ' -' : '-').' '.date($this->_date_fmt). ' --> '.$msg."\n";
$message .= $level.' - '.gmdate($this->_date_fmt). ' --> '.$msg."\n";

Why?
Our server is in America but our visitors are in Portugal, so I need to write logs using gmdate.
The other thing is just to remove an unnecessary if
Code:
if ( $level == 'INFO' )
  echo ' -';
else
  echo '-';
//Just because a space between "-" and the message?

Regards


Error loging class - El Forum - 06-02-2010

[eluser]mddd[/eluser]
Why would you need to change the times? It seems to me that it is much more logical and reliable to use the server's own time in your logs. Maybe some of your visitors are in Brazil. Or in African countries. What does it matter? The log should help you locate problems, and for that, the server's time is important.
Example: if you see that something went wrong saving a file; how do you know the right time? The file modification times will not match your logfile!


Error loging class - El Forum - 06-02-2010

[eluser]ELRafael[/eluser]
99,999% you are right.

But sometimes I need to check by the user time.
I have some queries that need to check the user's time. So I need to check what time the query was run. In this case, the user time is muuuuch more important for me.
The file modification still the server time, not the user time.

But this is a special case.


[quote author="mddd" date="1275497608"]Why would you need to change the times? It seems to me that it is much more logical and reliable to use the server's own time in your logs. Maybe some of your visitors are in Brazil. Or in African countries. What does it matter? The log should help you locate problems, and for that, the server's time is important.
Example: if you see that something went wrong saving a file; how do you know the right time? The file modification times will not match your logfile![/quote]