In order to instantiate a LoggerFactory instance (when NOT coding for an extension), the manual says to "use one of the core logging channels". Is this supposed to be defined or standardized somewhere like Manual:$wgLogTypes is? Because when I search core, there are dozens of different "channels" and there doesn't seem to be any rhyme or reason to them. The manual might as well say "use any string".
Manual talk:Structured logging
Use one of the core logging channels?
Brian's comments helped me understand the different logging mechanisms, and the usage of each.
Yes, it really is basically "use any string that is configured to record debug log events to a file in your local MediaWiki deployment". There is no central codified list of widely used log channels.
For a deployment where
$wgDebugLogFile logging is being used it really does not matter. For a deployment like the Wikimedia production cluster where individual log channels are selectively enabled then the choice does make a difference. When converting a wfDebugLog() call, use the same channel name. When converting a wfDebug() call, use your best judgement for selecting an existing channel or creating a new channel using an arbitrary string.
Doesn't work in extensions??
Missing use statement
$mylog = LoggerFactory::getInstance( "mylog" ); $mylog->debug( "Foo bar" );
Fatal error: Class 'LoggerFactory' not found in .../extensions/CharInsert/CharInsert.body.php on line 15
Do you have a
use MediaWiki\Logger\LoggerFactory; at the top of the file?
Thanks, that fixed it.