Answer the question
In order to leave comments, you need to log in
Concise class for event logging
It was necessary to log events in the application.
Required:
1. A simple one-line call at the point where the message is written.
2. Ability to specify message levels (error, message, etc.).
3. The ability to reassign where the data is stored and in what format.
Watched ZEND_LOG, LOG4PHP, is there something more compact? I don't really want to reinvent the wheel.
Answer the question
In order to leave comments, you need to log in
file_put_contents(LOG_FILE_NAME, $logMessage, FILE_APPEND); - class and public static function log you can enter yourself.
Look at this class on github - this is a diagnostic class
begin() - initializes the log
log( $text, $isImportantly = false ) - actually add an entry to the log, with a note of importance
showLog( $logMode = DIAGNOSTICS_LOG_MODE_TEXT ) - log output, 2 modes are available - html and
each line is output to the stream with a timestamp in milliseconds with an accuracy of 2 decimal places . The
registry is used as storage - i.e. you will need to place the repository inside the class so as not to drag along MB\Registry.php
To implement all your needs, you need a minimum of interventions in the log and showLog methods
In my opinion there is nothing simpler and more powerful and to fit your criteria than the Pear Log package: http://pear.php.net/package/Log . Pretty intelligible documentation with examples here .
Monolog - you can’t call it compact, but in terms of flexibility where to assign something ... Various wrappers a la pipes, etc. For example, I liked the ability to send soap to error, except for writing to the log.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question