Logging - ParkitectNexus/ParkitectNexusClient GitHub Wiki
The Unity way of logging is via UnityEngine.Debug.Log(...)
and its variants. The log file is Parkitect\Parkitect_Data\output_log.txt
. Uncatched exceptions are logged to that file too (with their StackTrace).
The log file's created new every time Parkitect starts. New messages are added at the end of the file when they are logged. That means you must reload the file in your text editor to see new logs. Some text editors can auto-refresh a file when it changed (e.g. Notepad++ with a "Document monitor" plugin).
Besides opening the log file in a text editor, a debug console with the log messages and exceptions can be brought up in Parkitect by hitting Ctrl+Alt+D
. However that window only displays messages that are logged while it's open.
ModTools.Debug provides a wrapper around UnityEnginge.Debug.Log
but can also put your log messages into the Parkitect notification bar.
You can switch the output by setting consoleOnly
: if false
it displays messages in the notification bar, else (false
) it uses UnityEngine.Debug.Log
and therefore outputs the debug messages to Parkitect\Parkitect_Data\output_log.txt
.
The available logging command are:
-
LogMT(string text)
: Logs the passed text. PrependsDebug.textPrefix
and the current time (ifDebug.showTime
is enabled).- this function is the base for all other
LogMT
methods.
- this function is the base for all other
-
LogMT(List<string> texts)
: Logs each passed string individually. -
LogMT(string[] names, string[] values)
: For key-value pairs.- Each pair is logged individually.
-
names
andvalues
must have the same length.
-
LogMT(string[] names, long[] values, uint mode = 0)
: For key-value pairs.-
mode=0
: same as above,values
are just converted into strings -
mode=1
: assumesvalues
are unix timestamps and converts them into date time -
mode=2
: assumesvalues
are durations in ms and converts them into time span - Last two are useful for measuring time like with
System.Diagnostics.StopWatch
-