pmjones/stdlog

将日志输出到STDOUT和STDERR。

1.0.0 2023-05-10 21:26 UTC

This package is auto-updated.

Last update: 2024-09-15 04:05:38 UTC


README

使用此psr/log实现来将日志输出到STDOUTSTDERR

非常适合将日志输出到控制台...

use pmjones\Stdlog\Stdlog;

$log = new Stdlog();

// info level logs to STDOUT
$log->info('Hello world!');

// all other levels log to STDERR
$log->error('Other world!');

...或者输出到流

use pmjones\Stdlog\Stdlog;

$log = new Stdlog(
    stdout: fopen('php://memory', 'w'),
    stderr: fopen('php://memory', 'w')
);

// info level logs to STDOUT
$log->info('Hello world!');

// all other levels log to STDERR
$log->error('Other world!');