Reimplement 'logger_detect_verbose_mode' setting

This commit is contained in:
JeremyStar™ 2024-04-24 01:39:38 +02:00
parent e7d0a9d9a6
commit b4e4a4df1f
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
3 changed files with 4 additions and 5 deletions

View file

@ -30,8 +30,7 @@ Determines if the logger's output should be colored.
Updating this during runtime does nothing. Updating this during runtime does nothing.
::: :::
Determines if the logger should check if running in verbose mode (see [`OS.is_stdout_verbose`](https://docs.godotengine.org/en/4.2/classes/class_os.html#class-os-method-is-stdout-verbose)). \ Determines if the logger should check if running in verbose mode (see [`OS.is_stdout_verbose`](https://docs.godotengine.org/en/4.2/classes/class_os.html#class-os-method-is-stdout-verbose)). \
Comes with a huge performance penalty on startup, delaying startup by about one to two seconds. \ Update `verbose_mode` yourself accordingly if you've set this to `false`, or face messed up diagnostic log messages. \
Update `verbose_mode` accordingly yourself if you've disabled this, or diagnostic log messages might appear messed up. \
### *String* <u>logger_format</u> = *"%color%[%time%] [%level% %source%:%line%] %message%"* ### *String* <u>logger_format</u> = *"%color%[%time%] [%level% %source%:%line%] %message%"*
The template for all log messages The template for all log messages
Available placeholders are: `%time%`, `%time_ms%`, `%level%`, `%color%`, `%message%`, `%source%`, `%source_raw%`, `%function%` and `%line%` Available placeholders are: `%time%`, `%time_ms%`, `%level%`, `%color%`, `%message%`, `%source%`, `%source_raw%`, `%function%` and `%line%`

View file

@ -26,8 +26,7 @@ class_name CoreConfiguration
## Determines if the logger's output should be colored. ## Determines if the logger's output should be colored.
@export var logger_colored: bool @export var logger_colored: bool
## Determines if the logger should check if running in verbose mode (see [method OS.is_stdout_verbose]).[br] ## Determines if the logger should check if running in verbose mode (see [method OS.is_stdout_verbose]).[br]
## Comes with a huge performance penalty on startup, delaying startup by about one to two seconds.[br] ## Update [code]verbose_mode[/code] yourself accordingly if you've set this to [code]false[/code], or face messed up diagnostic log messages.[br]
## Update [code]verbose_mode[/code] accordingly yourself if you've disabled this, or diagnostic log messages might appear messed up.[br]
## [b]Warning: [i]Updating this during runtime does nothing.[/i][/b] ## [b]Warning: [i]Updating this during runtime does nothing.[/i][/b]
@export var logger_detect_verbose_mode: bool @export var logger_detect_verbose_mode: bool
## The template for all log messages.[br] ## The template for all log messages.[br]
@ -72,6 +71,7 @@ func _init() -> void:
# Logger # Logger
logger_level = CoreTypes.LoggerLevel.INFO logger_level = CoreTypes.LoggerLevel.INFO
logger_colored = true logger_colored = true
logger_detect_verbose_mode = true
logger_format = "%color%[%time%] [%level% %origin%] %message%" logger_format = "%color%[%time%] [%level% %origin%] %message%"
logger_newlines_override = true logger_newlines_override = true
logger_newlines_sizelimit = 40 logger_newlines_sizelimit = 40

View file

@ -195,7 +195,7 @@ func apply_configuration() -> void:
custom_modules[module]._pull_config() custom_modules[module]._pull_config()
# Workaround # Workaround
logger.verbose_mode = OS.is_stdout_verbose() if config.logger_detect_verbose_mode: logger.verbose_mode = OS.is_stdout_verbose()
# +++ custom module support +++ # +++ custom module support +++
## Registers a new custom module. ## Registers a new custom module.