Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F56339234
WithLog.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
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
Sat, Nov 7, 05:02 (2 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4239256
Default Alt Text
WithLog.php (2 KB)
Attached To
Mode
rSAASMW SaaS MediaWiki
Attached
Detach File
Event Timeline
Log In to Comment