Jump to content

Logging


Recommended Posts

You are always asking the most bizarre and unrelated questions.  I should have skipped this one too!   :)

 

I would say this is one of my least bizarre and most boring question.

 

Are you telling me that you never log anything other than errors?

...
syslog(LOG_INFO,'got to this point');
...
syslog(LOG_INFO,'array foo: '.json_encode($foo));
...
Link to comment
Share on other sites

No not at all.  When I first had the need I wrote a little include module that has a couple of functions in it open/close a file and to write and display the contents.  I did not go searching on the forums for a menial task such as this one.  You on the other hand see it as something that requires expertise.  

Link to comment
Share on other sites

No not at all.  When I first had the need I wrote a little include module that has a couple of functions in it open/close a file and to write and display the contents.  I did not go searching on the forums for a menial task such as this one.  You on the other hand see it as something that requires expertise.  

Maybe you should

Link to comment
Share on other sites

If you want to actually integrate logging into your app as a feature, I'd go with something like Monolog. If you're just trying to add some temporary logging for help debugging, use something like syslog, error_log, or some simple file logging function for simplicity.

 

If you're going to use Monolog or similar and you are already using depencency injection then you may as well inject it like any other service. Otherwise I'd probably use a factory class to obtain an instance of the logger. Monolog comes with a Registry class that could help with this.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.