Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F12427498
WithLog.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
WithLog.php
View Options
<?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 a 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
(),
LogLevel
::
Error
->
value
],
'formatter'
=>
'line'
,
],
],
'formatters'
=>
[
'line'
=>
[
'class'
=>
'
\\
Monolog
\\
Formatter
\\
LineFormatter'
],
],
]],
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Nov 7, 08:41 (1 d, 13 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3120784
Default Alt Text
WithLog.php (2 KB)
Attached To
Mode
rSAASMW SaaS MediaWiki
Attached
Detach File
Event Timeline
Log In to Comment