Changes

Jump to navigation Jump to search
m
Replace deprecated <source> tags with <syntaxhighlight> tags
Line 9: Line 9:  
For example, this code:
 
For example, this code:
   −
<source lang="c#">
+
<syntaxhighlight lang="c#">
 
this.Monitor.Log("a trace message", LogLevel.Trace);
 
this.Monitor.Log("a trace message", LogLevel.Trace);
 
this.Monitor.Log("a debug message", LogLevel.Debug);
 
this.Monitor.Log("a debug message", LogLevel.Debug);
Line 15: Line 15:  
this.Monitor.Log("a warning message", LogLevel.Warn);
 
this.Monitor.Log("a warning message", LogLevel.Warn);
 
this.Monitor.Log("an error message", LogLevel.Error);
 
this.Monitor.Log("an error message", LogLevel.Error);
</source>
+
</syntaxhighlight>
    
will log something like this:
 
will log something like this:
Line 56: Line 56:  
===Log once===
 
===Log once===
 
The <tt>LogOnce</tt> method lets you log a message just [[#Overview|like the above]], but only once per game launch. For example, you can use it to show a compatibility warning for an API call:
 
The <tt>LogOnce</tt> method lets you log a message just [[#Overview|like the above]], but only once per game launch. For example, you can use it to show a compatibility warning for an API call:
<source lang="c#">
+
<syntaxhighlight lang="c#">
 
this.Monitor.LogOnce("Some Mod Name used the deprecated X API.", LogLevel.Warn);
 
this.Monitor.LogOnce("Some Mod Name used the deprecated X API.", LogLevel.Warn);
</source>
+
</syntaxhighlight>
    
===Verbose logging===
 
===Verbose logging===
Line 64: Line 64:     
There are two ways to use it:
 
There are two ways to use it:
<source lang="c#">
+
<syntaxhighlight lang="c#">
 
// log a TRACE message if verbose logging is enabled
 
// log a TRACE message if verbose logging is enabled
 
this.Monitor.VerboseLog("This will only appear if verbose logging is enabled.");
 
this.Monitor.VerboseLog("This will only appear if verbose logging is enabled.");
Line 71: Line 71:  
if (this.Monitor.IsVerbose)
 
if (this.Monitor.IsVerbose)
 
   this.Monitor("This will only appear if verbose logging is enabled.", LogLevel.Trace);
 
   this.Monitor("This will only appear if verbose logging is enabled.", LogLevel.Trace);
</source>
+
</syntaxhighlight>
114

edits

Navigation menu