Files
uarep-ctl/addons/godot-logger
2024-08-21 10:24:23 +03:00
..
2023-07-25 08:46:38 +03:00
2024-08-21 10:24:23 +03:00
2023-07-25 08:46:38 +03:00
2023-07-25 08:46:38 +03:00
2023-07-25 08:46:38 +03:00
2023-07-25 08:46:38 +03:00

Godot-Log

Simple in-game logger for Godot 4.0.

Features

  • Installed as plugin.
  • Singleton Log.
  • Write to log file.
  • Disable log levels.
  • Custom log levels.

Installation:

  1. Clone or download this repository to addons folder.
  2. Enable Godot Log in Plugins.
  3. Add LogOutput node to the scene.
  4. Profit.

Usage:

Calling default levels:

Log.info(text)
Log.debug(text)
Log.warning(text)
Log.error(text)
Log.fatal(text)

Create a custom log level:

# main.gd
const CUSTOM = Log.MAX << 1 # Bitwise left shift the MAX value for a custom level.

func _ready() -> void:
	Log.add_level(CUSTOM, "Level Name")

Calling the custom level:

Log.message(CUSTOM, "Something happened")

Disable log level:

Log.set_level(Log.INFO, false) # Disable built-in level.
Log.set_level(CUSTOM, false) # Disable custom level.

Enable log level:

Log.set_level(Log.DEBUG, true) # Enable built-in level.
Log.set_level(CUSTOM, true) # Enable custom level.

License

Copyright (c) 2020-2023 Mansur Isaev and contributors

Unless otherwise specified, files in this repository are licensed under the MIT license. See LICENSE.md for more information.