Gamedev Framework (gf)  0.8.0
A C++14 framework for 2D games
Public Types | Public Member Functions | Static Public Member Functions | List of all members
gf::Log Class Reference

Logging functions. More...

#include <gf/Log.h>

Public Types

enum  Level : int {
  Debug,
  Info,
  Warn,
  Error,
  Fatal
}
 The severity level of the log. More...
 

Public Member Functions

 Log ()=delete
 Deleted constructor. More...
 

Static Public Member Functions

static void setLevel (Level level)
 Set a global severity level. More...
 
static void debug (const char *fmt,...)
 Print a debug message. More...
 
static void info (const char *fmt,...)
 Print an info message. More...
 
static void warning (const char *fmt,...)
 Print a warning message. More...
 
static void error (const char *fmt,...)
 Print an error message. More...
 
static void fatal (const char *fmt,...)
 Print a fatal message and quit. More...
 

Detailed Description

Logging functions.

Logging functions are used to report some events that have happened in the system. These functions print messages to the standard error. It uses printf-like format strings.

A message is associated to a severity level. The severity level indicates the severity of the message and range from a simple debug message to a fatal message.

You can set the minimum severity for which messages are displayed. By default, the minimum severity level is gf::Log::Warning (or gf::Log::Debug if debug mode is activated at build time).

Example:

int entity = ...;
gf::Log::warning("Something weird happened to entity %i!\n", entity);

Member Enumeration Documentation

◆ Level

enum gf::Log::Level : int

The severity level of the log.

Enumerator
Debug 

The debug level.

Info 

The info level.

Warn 

The warn level.

Error 

The error level.

Fatal 

The fatal level.

Constructor & Destructor Documentation

◆ Log()

gf::Log::Log ( )
delete

Deleted constructor.

Member Function Documentation

◆ debug()

static void gf::Log::debug ( const char *  fmt,
  ... 
)
inlinestatic

Print a debug message.

Parameters
fmtThe format string

◆ error()

static void gf::Log::error ( const char *  fmt,
  ... 
)
inlinestatic

Print an error message.

Parameters
fmtThe format string

◆ fatal()

static void gf::Log::fatal ( const char *  fmt,
  ... 
)
inlinestatic

Print a fatal message and quit.

Parameters
fmtThe format string

◆ info()

static void gf::Log::info ( const char *  fmt,
  ... 
)
inlinestatic

Print an info message.

Parameters
fmtThe format string

◆ setLevel()

static void gf::Log::setLevel ( Level  level)
static

Set a global severity level.

Parameters
levelThe severity level

◆ warning()

static void gf::Log::warning ( const char *  fmt,
  ... 
)
inlinestatic

Print a warning message.

Parameters
fmtThe format string