A powerful, feature-rich logging system for Godot 4 that brings structured logging to your game development workflow. Inspired by enterprise logging frameworks, Log4Godot provides multiple log levels, named loggers, colored output, theming support, and flexible configuration options.
- 6 Log Levels: TRACE, DEBUG, INFO, WARN, ERROR, FATAL with intuitive color coding
- Named Loggers: Create dedicated loggers for different systems (Network, AI, Physics, UI, etc.)
- Dual Output: Beautiful colored console output plus optional file logging
- Theming System: 4 built-in themes with custom theme support for personalized styling
- Timestamp Support: Configurable timestamp formatting with millisecond precision
- Hierarchical Control: Set global log levels and override per individual logger
- Download or clone this repository
- Copy the
addons/log4godot/
folder to your project'saddons/
directory - Enable "Log4Godot" in Project Settings → Plugins
- The
Logger
autoload is automatically configured and ready to use!
func _ready():
# Simple logging with the global logger
Logger.info("Game initialized successfully")
Logger.warn("Audio settings not found, using defaults")
Logger.error("Failed to connect to server")
Logger.debug("Player position: " + str(player.position))
# Create specialized loggers for different systems
var network_logger = Logger.get_logger("Network", LogLevel.Level.DEBUG)
var ai_logger = Logger.get_logger("AI", LogLevel.Level.INFO)
var physics_logger = Logger.get_logger("Physics", LogLevel.Level.WARN)
# Use them throughout your codebase
network_logger.debug("Sending packet to server: " + packet_data)
ai_logger.info("Enemy AI state changed: PATROL → CHASE")
physics_logger.warn("Collision detection took " + str(delta_time) + "ms")
Log4Godot includes a theming system that allows you to customize the appearance of your logs with built-in themes or create your own.
- 🎯 Default: Balanced color scheme with distinct colors for each log level (gray, cyan, yellow, red).
- 🔇 Minimal: Muted gray for most levels with only errors/fatal in red to reduce visual noise.
- ⚪ Whiteout: All text in pure white for complete uniformity and high contrast displays.
- 🟢 Fallout: Retro terminal aesthetic with all text in bright green for that classic console feel.
# Set minimum log level globally (affects all loggers)
Logger.set_global_level(LogLevel.Level.INFO)
# Toggle colored output in console
Logger.set_colors_enabled(false)
# Control timestamp display
Logger.set_timestamps_enabled(true)
# File logging configuration
Logger.set_file_logging_enabled(true, "user://debug.log")
# Each logger can have its own level
var verbose_logger = Logger.get_logger("Debug", LogLevel.Level.TRACE)
var quiet_logger = Logger.get_logger("Release", LogLevel.Level.ERROR)
# Change logger level at runtime
verbose_logger.set_level(LogLevel.Level.WARN)
# Check if specific levels are enabled
if network_logger.is_debug_enabled():
network_logger.debug("Detailed network state: " + get_network_details())