Download the PHP package metarush/log-once without Composer
On this page you can find all versions of the php package metarush/log-once. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download metarush/log-once
More information about metarush/log-once
Files in metarush/log-once
Package log-once
Short Description Log messages, usually error messages, only once and optionally get notified. No more flood of error logs with the same message.
License MIT
Informations about the package log-once
metarush/log-once
Log messages, usually error messages, only once and optionally get notified. No more flood of error logs with the same message.
Install
Install via composer as metarush/log-once
Sample usage
Log adapters
File system
Note: To mark a log file as read, rename it with a __ALREADYREAD suffix
e.g., 2021-01-01_00-00-00_+0000__12345__ALREADYREAD.log or you can simply delete the file.
PDO database (e.g., MySQL, PostgreSQL, SQLite)
Create a table with ff. fields:
idINTEGER PRIMARY KEY AUTOINCREMENT,createdOnDATETIME, // must use YYYY-MM-DD HH:MM:SShashTEXT, // make length as long as your hash function's output e.g., if \md5(), must be 32messageTEXT, // make length as long your log messagesalreadyReadINTEGER // will have 1 or 0 value, can be ENUM or UNSIGNED TINY INT if you want
Note: To mark a log row as read, set the alreadyRead column to 1 or you can simply delete the row.
Notifiers
We use the package metarush/notifier as notifier
Inject $notifiers in ->setNotifiers($notifiers) to the sample usage above.
For more info on how to use other available notifiers such as email visit metarush/notifier
Viewing logs
A UI to view the logs is not included in this package. You can simply use whatever database admin tool you're using if you're using PDO logger, or manually view the file system, if you're using the File system logger.