Changes

→‎Logging: + verbose logging
Line 53: Line 53:  
| Important information to highlight for the player when player action is needed (e.g. new version available). This should be used rarely to avoid alert fatigue.
 
| Important information to highlight for the player when player action is needed (e.g. new version available). This should be used rarely to avoid alert fatigue.
 
|}
 
|}
 +
 +
===Verbose logging===
 +
{{SMAPI upcoming|2.8}}
 +
 +
You can have messages appear in the log (and console in the ''for developers'' version) only if SMAPI's verbose logging option is enabled. This is meant for diagnostic information that's sometimes needed to troubleshoot, but doesn't need to be logged in most cases. Players can enable verbose logging by editing the <tt>smapi-internal/StardewModdingAPI.config.json</tt> file.
 +
 +
There are two ways to use it:
 +
<source lang="c#">
 +
// log a TRACE message if verbose logging is enabled
 +
this.Monitor.VerboseLog("This will only appear if verbose logging is enabled.");
 +
 +
// check the verbose option
 +
if (this.Monitor.IsVerbose)
 +
  this.Monitor("This will only appear if verbose logging is enabled.", LogLevel.Trace);
 +
</source>
    
==Emergency shutdown==
 
==Emergency shutdown==
translators
8,404

edits