Static Public Member Functions | |
| static | log ($message) |
| static | debug ($message) |
| static | info ($message) |
| static | warn ($message) |
| static | error ($message) |
| static | fatal ($message) |
| static | alog ($message) |
| static | adebug ($message) |
| static | ainfo ($message) |
| static | awarn ($message) |
| static | aerror ($message) |
| static | afatal ($message) |
| static | flush () |
| static | flushHandler ($signal, &$params) |
| static | activeAssert () |
Public Attributes | |
| const | ALL = 1 |
| const | DEBUG = 5 |
| const | INFO = 6 |
| const | WARN = 7 |
| const | ERROR = 8 |
| const | FATAL = 9 |
| const | OFF = 10 |
Static Public Attributes | |
| static | $stack = array() |
| static | $reverse |
| static | $level = 6 |
| static | $assert_mess = null |
| static | $assert_level = 6 |
Static Private Member Functions | |
| static | _log ($level, $message) |
| static | _alog ($level, $message) |
Logging while keeping a high performance in production is hard, it is even harder if we want to track the point in the code where the log information is generated, for example the file name and line number. PHP offers the assert statement which, used in a not so conventional way can get everything in a very efficient way.
Note that the messages do not need to be strings. You can log whatever you want. How the message is then stored in your logs is up to the writer you are using. This can be for example a JSON fragment.
The removal of constraints on the log message simplify the log system as you can push into it categories or extra informations.
In the log stack, each log message is microtimed together with the log level as integer. You can convert the integer to string at write time.
| static Pluf_Log::_log | ( | $ | level, | |
| $ | message | |||
| ) | [static, private] |
Log the information in the stack.
Flush the information if needed.
| $level | Level to log | |
| $message | Message to log |
| static Pluf_Log::_alog | ( | $ | level, | |
| $ | message | |||
| ) | [static, private] |
Base assert logger.
The assert logging is a two step process as one need to go through the assertion callback.
| $level | Level to log | |
| $message | Message to log |
| static Pluf_Log::log | ( | $ | message | ) | [static] |
Log at the ALL level.
| $message | Message to log |
| static Pluf_Log::debug | ( | $ | message | ) | [static] |
Log at the DEBUG level.
| $message | Message to log |
| static Pluf_Log::info | ( | $ | message | ) | [static] |
| static Pluf_Log::warn | ( | $ | message | ) | [static] |
| static Pluf_Log::error | ( | $ | message | ) | [static] |
| static Pluf_Log::fatal | ( | $ | message | ) | [static] |
| static Pluf_Log::alog | ( | $ | message | ) | [static] |
Assert log at the ALL level.
| $message | Message to log |
| static Pluf_Log::adebug | ( | $ | message | ) | [static] |
Assert log at the DEBUG level.
| $message | Message to log |
| static Pluf_Log::ainfo | ( | $ | message | ) | [static] |
| static Pluf_Log::awarn | ( | $ | message | ) | [static] |
| static Pluf_Log::aerror | ( | $ | message | ) | [static] |
| static Pluf_Log::afatal | ( | $ | message | ) | [static] |
| static Pluf_Log::flush | ( | ) | [static] |
Flush the data to the writer.
This reset the stack.
| static Pluf_Log::flushHandler | ( | $ | signal, | |
| &$ | params | |||
| ) | [static] |
Signal handler to flush the log.
The name of the signal and the parameters are not used.
| $signal | Name of the signal | |
| &$params | Parameters |
| static Pluf_Log::activeAssert | ( | ) | [static] |
Activation of the low impact logging.
When called, it enabled the assertions for debugging.
Pluf_Log::$stack = array() [static] |
The log stack.
A logger function is just pushing the data in the log stack, the writers are then called to write the data later.
| const Pluf_Log::ALL = 1 |
Different log levels.
| const Pluf_Log::DEBUG = 5 |
| const Pluf_Log::INFO = 6 |
| const Pluf_Log::WARN = 7 |
| const Pluf_Log::ERROR = 8 |
| const Pluf_Log::FATAL = 9 |
| const Pluf_Log::OFF = 10 |
Pluf_Log::$reverse [static] |
Initial value:
array(1 => 'ALL', 5 => 'DEBUG', 6 => 'INFO', 7 => 'WARN', 8 => 'ERROR', 9 => 'FATAL')
Pluf_Log::$level = 6 [static] |
Current log level.
By default, set to 6, which is the INFO level.
Pluf_Log::$assert_mess = null [static] |
Current message in the assert log.
Pluf_Log::$assert_level = 6 [static] |
Current level of the message in the assert log.