logger.gd

Extends: Node

Description

Constants Descriptions

DEBUG

const DEBUG: logger.gd.LogLevel = 1

ERROR

const ERROR: logger.gd.LogLevel = 4

ERROR_MESSAGES

const ERROR_MESSAGES: Dictionary = {"0":"OK.","1":"Generic error.","2":"Unavailable error.","3":"Unconfigured error.","4":"Unauthorized error.","5":"Parameter range error.","6":"Out of memory (OOM) error.","7":"File: Not found error.","8":"File: Bad drive error.","9":"File: Bad path error.","10":"File: No permission error.","11":"File: Already in use error.","12":"File: Can't open error.","13":"File: Can't write error.","14":"File: Can't read error.","15":"File: Unrecognized error.","16":"File: Corrupt error.","17":"File: Missing dependencies error.","18":"File: End of file (EOF) error.","19":"Can't open error.","20":"Can't create error.","21":"Query failed error.","22":"Already in use error.","23":"Locked error.","24":"Timeout error.","25":"Can't connect error.","26":"Can't resolve error.","27":"Connection error.","28":"Can't acquire resource error.","29":"Can't fork process error.","30":"Invalid data error.","31":"Invalid parameter error.","32":"Already exists error.","33":"Does not exist error.","34":"Database: Read error.","35":"Database: Write error.","36":"Compilation failed error.","37":"Method not found error.","38":"Linking failed error.","39":"Script failed error.","40":"Cycling link (import cycle) error.","41":"Invalid declaration error.","42":"Duplicate symbol error.","43":"Parse error.","44":"Busy error.","45":"Skip error.","46":"Help error.","47":"Bug error.","48":"Printer on fire error."}

INFO

const INFO: logger.gd.LogLevel = 2

LEVEL_NAMES

const LEVEL_NAMES: Array = ["TRACE","DEBUG","INFO","WARNING","ERROR"]

LEVEL_NAMES_SHORT

const LEVEL_NAMES_SHORT: Array = ["TRC","DBG","INF","WRN","ERR"]

LogLevel

enum LogLevel{TRACE = 0, DEBUG = 1, INFO = 2, WARNING = 3, ERROR = 4, MAX = 5}

TRACE

const TRACE: logger.gd.LogLevel = 0

WARNING

const WARNING: logger.gd.LogLevel = 3

Method Descriptions

trace

func trace(p_message: String, p_stack_depth: int = 1, p_stack_hint: int = 2) -> void

debug

func debug(p_message: String) -> void

info

func info(p_message: String) -> void

warning

func warning(p_message: String) -> void

error

func error(p_message: String) -> void

set_level

func set_level(p_level: logger.gd.LogLevel) -> void

get_level

func get_level() -> logger.gd.LogLevel

set_log_record_formatter

func set_log_record_formatter(p_log_record_formatter: LogRecordFormatter) -> void

add_sink

func add_sink(p_sink: LogSink) -> void

remove_sink

func remove_sink(p_sink: LogSink) -> void

flush_buffer

func flush_buffer() -> void

format_log_level_name (static)

func format_log_level_name(p_level: logger.gd.LogLevel) -> String

Returns the full name of a log level.

format_log_level_name_short (static)

func format_log_level_name_short(p_level: logger.gd.LogLevel) -> String

Returns a three letter abbreviation of a log level.

format_month_short (static)

func format_month_short(p_month: int) -> String

Returns a three letter abbreviation of a month.

format_session_id (static)

func format_session_id(p_session_id: int) -> String

Formats the session id number to a string truncated to 4 digits.

format_time_default (static)

func format_time_default(p_unix_time: float) -> String

Formats a unix timestamp to a string. The default formatter uses this format.

format_time_default_for_filename (static)

func format_time_default_for_filename(p_unix_time: float) -> String

Formats a unix timestamp to a string. The DirSink uses this format.

pad_string (static)

func pad_string(p_string: String, p_length: int, p_pad_char: String = " ") -> String

Left pads a string with a character to a given length.

format_error (static)

func format_error(p_error: int) -> String

Sub-classes

LogSink

Method Descriptions

write_bulks

func write_bulks(p_log_records: Array[Dictionary], p_formatted_messages: PackedStringArray) -> void

Write many log records to the sink

flush_buffer

func flush_buffer() -> void

Flushes the buffer of the sink if it has one.

close

func close() -> void

Cleans up resources used by the sink.

FilteringPipe

Method Descriptions

_init

func _init(p_sink: LogSink, p_level: logger.gd.LogLevel) -> FilteringPipe

write_bulks

func write_bulks(p_log_records: Array[Dictionary], p_formatted_messages: PackedStringArray) -> void

flush_buffer

func flush_buffer() -> void

close

func close() -> void

BroadcastPipe

Method Descriptions

add_sink

func add_sink(p_sink: LogSink) -> void

remove_sink

func remove_sink(p_sink: LogSink) -> void

write_bulks

func write_bulks(p_log_records: Array[Dictionary], p_formatted_messages: PackedStringArray) -> void

flush_buffer

func flush_buffer() -> void

close

func close() -> void

BufferedPipe

Method Descriptions

_init

func _init(p_sink: LogSink, p_buffer_size: int = 42) -> BufferedPipe

Creates a new BufferedPipe.

The buffer size is the number of messages that will be buffered before being flushed to the sink.

flush_buffer

func flush_buffer() -> void

set_buffer_flush_interval_msec

func set_buffer_flush_interval_msec(p_buffer_flush_interval_msec: int) -> void

Set to 0 to disable interval flushing.

write_bulks

func write_bulks(p_log_records: Array[Dictionary], p_formatted_messages: PackedStringArray) -> void

close

func close() -> void

ConsoleSink

Method Descriptions

write_bulks

func write_bulks(p_log_records: Array[Dictionary], p_formatted_messages: PackedStringArray) -> void

flush_buffer

func flush_buffer() -> void

DirSink

Method Descriptions

_init

func _init(p_log_name: String, p_dir_path: String, p_max_file_size: int = 4042, p_max_file_count: int = 10) -> DirSink

flush_buffer

func flush_buffer() -> void

write_bulks

func write_bulks(p_log_records: Array[Dictionary], p_formatted_messages: PackedStringArray) -> void

close

func close() -> void

MemoryWindowSink

Method Descriptions

_init

func _init(p_max_lines: int = 100) -> MemoryWindowSink

write_bulks

func write_bulks(p_log_records: Array[Dictionary], p_formatted_messages: PackedStringArray) -> void

flush_buffer

func flush_buffer() -> void

get_buffer

func get_buffer() -> Dictionary

FormattingPipe

Method Descriptions

_init

func _init(p_sink: LogSink, p_log_record_formatter: LogRecordFormatter) -> FormattingPipe

write_bulks

func write_bulks(p_log_records: Array[Dictionary], p_formatted_messages: PackedStringArray) -> void

flush_buffer

func flush_buffer() -> void

close

func close() -> void

LogRecordFormatter

Method Descriptions

format

class LogRecordFormatter

Logger

Method Descriptions

_init

func _init(p_tag: String, p_level: logger.gd.LogLevel = 0, p_log_record_formatter: LogRecordFormatter = null, p_sink: LogSink = null) -> Logger

write_bulks

func write_bulks(p_log_records: Array[Dictionary], p_formatted_messages: PackedStringArray) -> void

Write will not format the message, it will just pass it to the underlying sink.

flush_buffer

func flush_buffer() -> void

get_tag

func get_tag() -> String

set_level

func set_level(p_level: logger.gd.LogLevel) -> void

get_level

func get_level() -> logger.gd.LogLevel

set_log_record_formatter

func set_log_record_formatter(p_log_record_formatter: LogRecordFormatter) -> void

log

func log(p_level: logger.gd.LogLevel, p_message: String, p_log_record: Dictionary = null) -> void

trace

func trace(p_message: String, p_stack_depth: int = 1, p_stack_hint: int = 1) -> void

debug

func debug(p_message: String) -> void

info

func info(p_message: String) -> void

warning

func warning(p_message: String) -> void

error

func error(p_message: String) -> void

close

func close() -> void

LogTimer

Method Descriptions

_init

func _init(p_message: String, p_threshold_msec: int = 0, p_logger: Logger = null) -> LogTimer

set_level

func set_level(p_level: logger.gd.LogLevel) -> void

set_threshold_msec

func set_threshold_msec(p_threshold_msec: int) -> void

start

func start() -> void

stop

func stop() -> void