Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logger separators are not preserved when injected #6

Open
jaumarro opened this issue Feb 13, 2018 · 0 comments
Open

Logger separators are not preserved when injected #6

jaumarro opened this issue Feb 13, 2018 · 0 comments

Comments

@jaumarro
Copy link

Hi,
first of all, great logger!
When I merge two loggers with different separators the merged logger has it's own separator instead of keeping the ones I set before.

$streamFormatter = new LogFormatter();
$streamFormatter->separator = '|';

$streamLogger = new Logger\Stream('php://output');
$streamLogger->setLogFormatter($streamFormatter);
$streamLogger->info('stream');

$fileFormatter = new LogFormatter();
$fileFormatter->separator = '#';

$fileLogger = new Logger\File('logs/log_'.date('Y-m-d').'.log');
$fileLogger->setLogFormatter($fileFormatter);
$fileLogger->info('file');

$mergedLogger = new Logger(array($streamLogger, $fileLogger));
$mergedLogger->info('merged');

In this example the output in screen is:
"stream|merged
"
and in the file:
"file#merged
"
when I expected
"stream|merged|"
and
"file#merged#"

Is this a bug or a feature?
Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant