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

Don't know why you think that....

 

I get along with my coding just fine.  I don't overthink it I don't overwrite it.  And I do research when something is beyond my knowledge.

 

Have fun.  Signing off this topic.

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.