Download the PHP package iburn36360/logger without Composer
On this page you can find all versions of the php package iburn36360/logger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download iburn36360/logger
More information about iburn36360/logger
Files in iburn36360/logger
Package logger
Short Description A Logging utility capable of formatting error output with stack traces, exception logging separately, fatal error handling and runtime log file swapping
License Apache-2.0
Homepage https://github.com/IBurn36360/Logger
Informations about the package logger
IBurn36360\Logger
A simple logging utility used to capture all PHP related issues in a formatted manner and keep them out of page output.
License
Usage
Using this logger is fairly simple. Creating an instance of the logger will create the logging direcotry (Recursively and with permissions 775 to account for different hosting setups) and make the initial logging file. If a logging file exists already it will reopen it in append mode.
Log files should end with .php so that they are execute instead of read. Log files are created with as the first line to prevent them from being readable in most environments.
Writing to the log
Writing to the log can be done in a few ways. The traditional function works properly with this library and will emit a log entry, as well as a complete stack trace for contect of the error. For manually logging entries, such as cases that aren't necessarilly errors, you can also call into the logLine function.
Both will produce a log entry, completely formatted for readability. The format looks something like the following:
The format is as follows:
The spacers account for changes in the log type so that the start of entries is almost always in the same place. Stack traces are indented after the error and no timestamp is logged for the trace lines. This aids readability by spacing out individual entries from one another.
Custom logging
Custom logging can be achieved by calling into the logCustomLine function
Every custom log entry is spaced out as if it has no log type, omitting that part of the log. Every custom log entry is written as-is and always includes a timestamp.
Updating the log file
If you have any needs to update the log file, such as swapping from an initialition state log to an operation log (I do this), there is a function to also facilitate this. It first closes the initial log file and opens up the new one, creating the path recursively if the path does not exist.