-
Notifications
You must be signed in to change notification settings - Fork 3
Log
Log is an easy way to print things out or record them.
By default, when DEBUG is defined, Log.PrintToConsole
is true
and Log.SaveOnError
is false
. These defaults are flipped otherwise. These may be set at runtime.
The assumption here is, that when you are making your game, you'll probably build is as a "Console Application" ([Your Project] right click > Properties.. > General/Project > TargetType) and when you are building for release, the TargetType will be "GUI Application" (meaning no additional console window will open).
When Log.SaveOnError
is true
, the log will be prepended to a file "log.txt" in the Core.System.UserPath
directory. The log calls made before this [and after the last error call] and the most recent error call up to a maximum of 16 (can be expanded to 128, see (Preprocessor defines)[LINK TO PREPROCESSOR HERE]) lines total will be saved. This file might be useful for user bug reports.
You can also force-save the log record to a path of your choosing yourself using Log.SaveToFile(String path)
. This behaves just like what Log.SaveOnError
does.
There are four types of logging calls, Log.Debug
, Log.Message
, Log.Warning
and Log.Error
. Each function takes in either a String
or an ´Object´ to log.
Log.Debug
calles are automatically ignored when not building for DEBUG.
You may choose to ignore calls to Log.Message
and Log.Warning
respectively. See (Preprocessor defines)[LINK TO PREPROCESSOR HERE].
If you want to receive log messages as well, you can do so by using the Log.OnLine
event.
PILE_LONG_LOG_RECORD
increases amount of output log lines Log remembers from 16 to 128
PILE_DISABLE_LOG_MESSAGES
adds [SkipCall] attribute to Log.Message functions
PILE_DISABLE_LOG_WARNINGS
adds [SkipCall] attribute to Log.Warning functions
PILE_DISABLE_PACKAGER
removes package building functionality from EntryPoint
This list is maintained in "Core/Core.bf". This is a copy.