Logger Manager

Grail provides its own logger manager which can be integrated into a game engine of your choice. Default logger is called "grail" and it shows messages regarding the core library (for example: warning when a user passes improper config data). Default sink of "grail" logger is synchronized and writes info to standard output.

Logger can show messages tagged with one of the following severities:
  1. TRACE

  2. DEBUG

  3. INFO

  4. WARNING

  5. ERROR

  6. CRITICAL - something is so wrong that after showing the message, the program should crash

Using the logger interface differs depending on the programming language you use.

Sinks

Sink is a form of output to which logger writes. The user decides whether it is synchronized to not cause races while running on multiple threads. While implementing custom sinks, user should override Log method.

Important interface

CreateLogger

Users can create their own custom loggers by providing their name. New logger will have no sinks by default, they need to be added manually.

AddSinkToLogger

Adds sink to existing logger. The number of sinks assigned to logger is unlimited.

Log

Logs a message the logger identified by the provided name.

Usage

  • C++

  • C#

//macro accesing logger manager singleton and writing warning message to "grail" logger
GRAIL_LOG("grail", Severity::WARNING, "something went wrong") // C++ macro simplifying logger usage
//logger manager singleton writing warning message to "grail" logger
LoggerManager.Log("grail", Severity.WARNING, "something went wrong");