Logger
It's a Logger.
Description
This is a Logger that logs with a standardised prefix in the form of:
It is recommended to use for_class to provide a unique logger for each individual GDScript. It's also possible to provide a unique prefix formatter using set_formatter or with_formatterMethods
void | debug ( String clazz, int line, String message, Array args ) |
void | error ( String clazz, int line, String message, Array args ) |
void | fatal ( String clazz, int line, String message, Array args ) |
ClassLogger | for_class ( clazz ) |
void | info ( String clazz, int line, String message, Array args ) |
void | set_formatter ( FuncRef prefix_formatter = PREFIX_FORMATTER ) |
void | warn ( String clazz, int line, String message, Array args ) |
Logger | with_formatter ( FuncRef prefix_formatter = PREFIX_FORMATTER ) |
Enumerations
enum LogLevel:
Denotes the log level.
Constants
FuncRef | MILLIS_PREFIX_FORMATTER | funcref(self, "build_prefix_millis") |
FuncRef | PREFIX_FORMATTER | funcref(self, "build_prefix") |
Method Descriptions
ClassLogger for_class ( clazz ):
Creates a ClassLogger which pre-supplies the clazz for the logging methods. clazz may be either a String containing the class name or a relevant instance of the class/ the GDScript itself with a CLASS_NAME constant providing the name as a String.
void debug ( String clazz, int line, String message, Array args ):
Logs a message at debug level. clazz denotes the GDScript that is being logged from, line denotes the line number and args is the parameters the message will be formatted with. clazz, line and args may each be omitted.
void info ( String clazz, int line, String message, Array args ):
Logs a message at info level. clazz denotes the GDScript that is being logged from, line denotes the line number and args is the parameters the message will be formatted with. clazz, line and args may each be omitted.
void warn ( String clazz, int line, String message, Array args ):
Logs a message at warn level. clazz denotes the GDScript that is being logged from, line denotes the line number and args is the parameters the message will be formatted with. clazz, line and args may each be omitted.
void error ( String clazz, int line, String message, Array args ):
Logs a message at error level. clazz denotes the GDScript that is being logged from, line denotes the line number and args is the parameters the message will be formatted with. clazz, line and args may each be omitted.
void fatal ( String clazz, int line, String message, Array args ):
Logs a message at fatal level. clazz denotes the GDScript that is being logged from, line denotes the line number and args is the parameters the message will be formatted with. clazz, line and args may each be omitted.
void set_formatter ( FuncRef prefix_formatter = PREFIX_FORMATTER ):
Sets prefix_formatter as this loggers prefix formatter. The prefix formatter is a FuncRef to any method with signature:
Logger with_formatter ( FuncRef prefix_formatter = PREFIX_FORMATTER ):
Creates and returns a new Logger with prefix_formatter as the loggers prefix formatter. The prefix formatter is a FuncRef to any method with signature: