-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Dev json logs #22994
Open
krezreb
wants to merge
12
commits into
5.x-dev
Choose a base branch
from
dev-json-logs
base: 5.x-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Dev json logs #22994
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
55d1f1b
wip
882f41c
add support for enable_json = true, custom_function_file, exclude_pat…
4ad7b33
Merge branch '5.x-dev' into dev-json-logs
krezreb 19852de
PHPCS format
b93f56f
PHPCS format
718d399
Merge branch '5.x-dev' into dev-json-logs
krezreb a5201fa
add type hints, FB discussion
e59eeda
Merge branch '5.x-dev' into dev-json-logs
krezreb f572fd4
phpcs
8f121ca
remove useless line
70d884b
yoda conditioning
66c096f
exception cleanup
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -226,22 +226,57 @@ | |
}), | ||
|
||
'Piwik\Plugins\Monolog\Formatter\LineMessageFormatter' => Piwik\DI::create('Piwik\Plugins\Monolog\Formatter\LineMessageFormatter') | ||
->constructor(Piwik\DI::get('log.short.format')), | ||
->constructor(Piwik\DI::get('log.short.format')), | ||
'log.lineMessageFormatter' => Piwik\DI::create('Piwik\Plugins\Monolog\Formatter\LineMessageFormatter') | ||
->constructor(Piwik\DI::get('log.short.format')), | ||
|
||
'log.lineMessageFormatter.file' => Piwik\DI::autowire('Piwik\Plugins\Monolog\Formatter\LineMessageFormatter') | ||
->constructor(Piwik\DI::get('log.trace.format')) | ||
->constructorParameter('allowInlineLineBreaks', false), | ||
->constructorParameter('allowInlineLineBreaks', false) | ||
->constructorParameter('customFunctionFile', Piwik\DI::get('log.custom_function_file')) | ||
->constructorParameter('excludePatterns', Piwik\DI::get('log.exclude_patterns')), | ||
|
||
'log.custom_function_file' => Piwik\DI::factory(function (Container $c) { | ||
if ($c->has('ini.log.custom_function_file')) { | ||
$path = $c->get('ini.log.custom_function_file'); | ||
if (!file_exists($path)) { | ||
return null; | ||
} | ||
|
||
if (!is_readable($path)) { | ||
return null; | ||
} | ||
|
||
return $path; | ||
} | ||
return null; | ||
}), | ||
|
||
'log.exclude_patterns' => Piwik\DI::factory(function (Container $c) { | ||
if ($c->has('ini.log.exclude_patterns')) { | ||
$excl = []; | ||
foreach (explode("|", $c->get('ini.log.exclude_patterns')) as $p) { | ||
$excl[] = trim($p); | ||
} | ||
return $excl; | ||
} | ||
return null; | ||
}), | ||
|
||
'log.short.format' => Piwik\DI::factory(function (Container $c) { | ||
if ($c->has('ini.log.enable_json')) { | ||
return 'json'; | ||
} | ||
if ($c->has('ini.log.string_message_format')) { | ||
return $c->get('ini.log.string_message_format'); | ||
} | ||
return '%level% %tag%[%datetime%] %message%'; | ||
}), | ||
|
||
'log.trace.format' => Piwik\DI::factory(function (Container $c) { | ||
if ($c->has('ini.log.enable_json')) { | ||
return 'json'; | ||
} | ||
Comment on lines
+277
to
+279
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we not pass it via There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above, looks like a dead feature |
||
if ($c->has('ini.log.string_message_format_trace')) { | ||
return $c->get('ini.log.string_message_format_trace'); | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we not pass this just via
ini.log.string_message_format
below?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michalkleiner I considered that but I found adding a new option is probably easier for users to understand. Also, in the viewer code https://github.com/matomo-org/plugin-LogViewer/blob/5a7687b3591566aa5cdd1235241e06fa9891415b/Log/Parser/Piwik.php#L25 doesn't use the format so might be a dead feature anyway