Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F24894915
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/LogLevel.php b/src/LogLevel.php
new file mode 100644
index 0000000..b5aec0c
--- /dev/null
+++ b/src/LogLevel.php
@@ -0,0 +1,19 @@
+<?php
+declare(strict_types=1);
+
+namespace Nasqueron\SAAS\MediaWiki;
+
+/*
+ * Levels should be aligned with monolog library Level enum.
+ */
+
+enum LogLevel: int {
+ case Debug = 100;
+ case Info = 200;
+ case Notice = 250;
+ case Warning = 300;
+ case Error = 400;
+ case Critical = 500;
+ case Alert = 550;
+ case Emergency = 600;
+}
diff --git a/src/WithLog.php b/src/WithLog.php
index 64ba60e..aca0e47 100644
--- a/src/WithLog.php
+++ b/src/WithLog.php
@@ -1,65 +1,65 @@
<?php
namespace Nasqueron\SAAS\MediaWiki;
trait WithLog {
public static function enableLog () : void {
$GLOBALS['wgMWLoggerDefaultSpi'] = self::getLoggerConfiguration();
}
private static function getLogPath () : string {
return "/var/log/mediawiki/error.log";
}
private static function getLoggerConfiguration () : array {
// See https://www.mediawiki.org/wiki/Manual:MonologSpi
return [
'class' => '\\MediaWiki\\Logger\\MonologSpi',
'args' => [[
'loggers' => [
'@default' => [
'processors' => [
'wiki',
'psr',
'web',
// Disable introspection if you use an handler like
// FingersCrossedHandler with several log entries.
'introspection',
],
'handlers' => [
'stream',
],
],
],
'processors' => [
'wiki' => [
'class' => '\\MediaWiki\\Logger\\Monolog\\WikiProcessor',
],
'psr' => [
'class' => '\\Monolog\\Processor\\PsrLogMessageProcessor',
],
'web' => [
'class' => '\\Monolog\\Processor\\WebProcessor',
],
'introspection' => [
'class' => '\\Monolog\\Processor\\IntrospectionProcessor',
],
],
'handlers' => [
'stream' => [
'class' => '\\Monolog\\Handler\\StreamHandler',
- 'args' => [ self::getLogPath() ],
+ 'args' => [ self::getLogPath(), LogLevel::Error->value ],
'formatter' => 'line',
],
],
'formatters' => [
'line' => [
'class' => '\\Monolog\\Formatter\\LineFormatter'
],
],
]],
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Wed, Mar 18, 13:24 (12 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3539996
Default Alt Text
(2 KB)
Attached To
Mode
rSAASMW SaaS MediaWiki
Attached
Detach File
Event Timeline
Log In to Comment