kingsoft/monolog-handler

Additional handlers monolog, log rotation and cron handler

1.0.1 2024-02-07 20:21 UTC

This package is auto-updated.

Last update: 2024-12-06 20:50:17 UTC


README

Use Kingoft/Utils to include make a global SETTINGS available

require $_SERVER['DOCUMENT_ROOT'] . '/vendor/kingsoft/utils/settings.inc.php';

CronRotatingFileHandler

Example usage

$log = new Monolog\Logger( SETTINGS['log']['name'] );

$log->pushHandler(
	new \Kingsoft\MonologHandler\CronRotatingFileHandler(
		SETTINGS['log']['location'] . '/' . SETTINGS['log']['name'] . '_info.log',
		Monolog\Level::fromName( SETTINGS['log']['level'],
		SETTINGS['logrotate'] )
	)
);

With this in the ini-file

[log]
name = "app"
location = "D:/Projekte/logs"
level = Info

[logrotate]
cronExpression = '* */1 * * *'
maxFiles = 2
minSize = 120
compress = false