Skip to content

ddj4747/Debug-Log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Debug Log

A lightweight, thread-safe logging utility for C++ that supports colored console output, timestamped log entries, and structured file logging.

🔧 Build Instructions

$ git clone https://github.com/ddj4747/Debug-Log.git
$ cd Debug-Log
$ mkdir build
$ cd build
$ cmake ..
$ cmake --build .

✨ Features

  • Thread-safe logging using std::mutex and std::lock_guard
  • Supports const char* and std::string input
  • Console output with color (using fmt)
  • File output:
    • All logs stored in logs/all/
    • Warnings and errors also stored in logs/errors/
  • Log entries are timestamped

📌 Dependencies

  • fmt for formatted and colored console output
  • boost stacktrace for debug stacktrace inside console
  • utfcpp for UTF-8 validation and invalid-sequence replacement

🚀 Usage

Basic Logging

Debug::Log("This is a standard log message.");
Debug::LogWarning("This is a warning.");
Debug::LogError("This is an error message.");

// You can also pass std::string:

std::string message = "Log message";
Debug::Log(message);

int playerScore = 128;
Debug::Log("Player score: {}", playerScore);

Example console output

$ [LOG     2025-06-24_12-34-56] This is a standard log message.
$ [WARNING 2025-06-24_12-34-56] This is a warning.
$ [ERROR   2025-06-24_12-34-56] This is an error message.
$ [LOG     2025-06-24_12-34-56] Log message
$ [LOG     2025-06-24_12-34-56] Player score: 128

📚 Additional

About

A lightweight, thread-safe logging utility for C++ that supports colored console output, timestamped log entries, and structured file logging.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors