Unigine.Log Class
This class represents an interface for printing various types of messages to the console and to the log file. It can be useful to monitor overall progress of application execution and report errors which can be helpful in the process of debugging.
To enable displaying system messages in the Console use the following command: console_onscreen 1
There are two custom color schemes highlighting log syntax for Notepad++ included in the SDK:
- <SDK>/utils/log_styles/notepad_light.xml
- <SDK>/utils/log_styles/notepad_dark.xml
By default all logged messages are saved to the Engine's log file, and printed to stdout, the latter may significantly affect peformance in case of much logging. If logging causes performance issues, you can control the two logging targets via the following console commands:
Example#
The following code demonstrates how to print various types of messages.
// auxiliary variables for messages
string file_name = "file.txt";
int ID = 10;
// reporting an error message
Log.Error("Loading mesh: can't open \"{0}\" file\n", file_name);
// reporting a message
Log.Message("-> Added {0} UI elements.\n", 10);
// reporting a warning message
Log.Warning("ID of the \"{0}\" file: {1}.\n", file_name, ID);
// reporting a fatal error message to the log file and closing the application
Log.Fatal("FATAL ERROR reading \"{0}\" file!\n", file_name);
Log Class
Members
void Error ( string format, ... ) #
Prints an error message to the console and the log file.Arguments
- string format - Error message to print.
- ... - Arguments, multiple allowed.
void ErrorLine ( formating format, ... ) #
Prints an error message followed by the line terminator to the console and the log file.Arguments
- formating format - Error message to print.
- ... - Arguments, multiple allowed.
void Fatal ( string format, ... ) #
Prints a fatal error message to the log file and quits the engine.Arguments
- string format - Fatal error message to print.
- ... - Arguments, multiple allowed.
void FatalLine ( string format, ... ) #
Prints a fatal error message followed by the line terminator to the log file and quits the engine.Arguments
- string format - Fatal error message to print.
- ... - Arguments, multiple allowed.
void Message ( string format, ... ) #
Prints a message to the console and the log file.Arguments
- string format - Message to print.
- ... - Arguments, multiple allowed.
void Message ( string format, ... ) #
Prints a message followed by the line terminator to the console and the log file.Arguments
- string format - Message to print.
- ... - Arguments, multiple allowed.
void Warning ( string format, ... ) #
Prints a warning to the console and the log file.Arguments
- string format - Warning to print.
- ... - Arguments, multiple allowed.
void WarningLine ( string format, ... ) #
Prints a warning followed by the line terminator to the console and the log file.Arguments
- string format - Warning to print.
- ... - Arguments, multiple allowed.
Last update:
2022-02-18
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)