# debug.cpp File Reference

Handling of printing debug messages. More...

`#include "stdafx.h"`
`#include <stdarg.h>`
`#include "console_func.h"`
`#include "debug.h"`
`#include "string_func.h"`
`#include "fileio_func.h"`
`#include "settings_type.h"`
`#include <time.h>`

Go to the source code of this file.

## Data Structures
struct | DebugLevel
## Defines
#define | DEBUG_LEVEL(x) { #x, &_debug_##x##_level }
## Functions
static void | debug_print (const char *dbg, const char *buf)
void CDECL | debug (const char *dbg, const char *format,...)
void | SetDebugString (const char *s)
const char * | GetDebugString ()
| Print out the current debug-level Just return a string with the values of all the debug categorites.
const char * | GetLogPrefix ()
| Get the prefix for logs; if show_date_in_logs is enabled it returns the date, otherwise it returns nothing.
## Variables
int | _debug_ai_level
int | _debug_driver_level
int | _debug_grf_level
int | _debug_map_level
int | _debug_misc_level
int | _debug_ms_level
int | _debug_net_level
int | _debug_sprite_level
int | _debug_oldloader_level
int | _debug_ntp_level
int | _debug_npf_level
int | _debug_yapf_level
int | _debug_freetype_level
int | _debug_sl_level
int | _debug_gamelog_level
int | _debug_desync_level
static const DebugLevel | debug_level []

## Detailed Description

Handling of printing debug messages.

Definition in file debug.cpp.

## Function Documentation

const char* GetDebugString | ( |  | ) |

Print out the current debug-level Just return a string with the values of all the debug categorites.

Returns:
  string with debug-levels

Definition at line 168 of file debug.cpp.

References endof, lastof, and strecat().

const char* GetLogPrefix | ( |  | ) |

Get the prefix for logs; if show_date_in_logs is enabled it returns the date, otherwise it returns nothing.

Returns:
  the prefix for logs (do not free), never NULL

Definition at line 191 of file debug.cpp.

References _settings_client, ClientSettings::gui, and GUISettings::show_date_in_logs.

Referenced by IConsolePrint().

## Variable Documentation

const DebugLevel debug_level[]`[static]`

Initial value:

     {
      DEBUG_LEVEL(ai),
      DEBUG_LEVEL(driver),
      DEBUG_LEVEL(grf),
      DEBUG_LEVEL(map),
      DEBUG_LEVEL(misc),
      DEBUG_LEVEL(ms),
      DEBUG_LEVEL(net),
      DEBUG_LEVEL(sprite),
      DEBUG_LEVEL(oldloader),
      DEBUG_LEVEL(ntp),
      DEBUG_LEVEL(npf),
      DEBUG_LEVEL(yapf),
      DEBUG_LEVEL(freetype),
      DEBUG_LEVEL(sl),
      DEBUG_LEVEL(gamelog),
      DEBUG_LEVEL(desync),
      }

Definition at line 51 of file debug.cpp.