OpenClonk
log-handle.cpp File Reference
#include "C4Include.h"
#include "lib/C4Log.h"
Include dependency graph for log-handle.cpp:

Go to the source code of this file.

Macros

#define IMPLEMENT_LOGF(func)
 

Functions

bool Log (const char *msg)
 
bool DebugLog (const char *strMessage)
 
bool LogFatal (const char *strMessage)
 
void c4_log_handle_clear ()
 
const char * c4_log_handle_get_first_log_message ()
 
unsigned int c4_log_handle_get_n_log_messages ()
 

Variables

std::string first_log
 
unsigned int n_logs = 0
 

Macro Definition Documentation

◆ IMPLEMENT_LOGF

#define IMPLEMENT_LOGF (   func)
Value:
bool func(const char *msg, ...) { \
va_list args; va_start(args, msg); \
StdStrBuf Buf; \
Buf.FormatV(msg, args); \
return Log(Buf.getData()); \
}
bool Log(const char *msg)
Definition: log-handle.cpp:24

Definition at line 40 of file log-handle.cpp.

Function Documentation

◆ c4_log_handle_clear()

void c4_log_handle_clear ( )

Definition at line 55 of file log-handle.cpp.

56 {
57  first_log.clear();
58  n_logs = 0;
59 }
std::string first_log
Definition: log-handle.cpp:21
unsigned int n_logs
Definition: log-handle.cpp:22

References first_log, and n_logs.

Referenced by c4_mapgen_handle_new(), and c4_mapgen_handle_new_script().

Here is the caller graph for this function:

◆ c4_log_handle_get_first_log_message()

const char* c4_log_handle_get_first_log_message ( )

Definition at line 61 of file log-handle.cpp.

62 {
63  if(first_log.empty()) return nullptr;
64  return first_log.c_str();
65 }

References first_log.

Referenced by c4_mapgen_handle_new(), and c4_mapgen_handle_new_script().

Here is the caller graph for this function:

◆ c4_log_handle_get_n_log_messages()

unsigned int c4_log_handle_get_n_log_messages ( )

Definition at line 67 of file log-handle.cpp.

68 {
69  return n_logs;
70 }

References n_logs.

Referenced by c4_mapgen_handle_new(), and c4_mapgen_handle_new_script().

Here is the caller graph for this function:

◆ DebugLog()

bool DebugLog ( const char *  strMessage)

Definition at line 37 of file log-handle.cpp.

37 { return Log(strMessage); }

References Log().

Here is the call graph for this function:

◆ Log()

bool Log ( const char *  msg)

Definition at line 24 of file log-handle.cpp.

25 {
26  if(first_log.empty())
27  {
28  assert(n_logs == 0);
29  first_log = msg;
30  }
31 
32  if(*msg != '\0')
33  ++n_logs;
34 
35  return true;
36 }

References first_log, and n_logs.

Referenced by DebugLog(), and LogFatal().

Here is the caller graph for this function:

◆ LogFatal()

bool LogFatal ( const char *  strMessage)

Definition at line 38 of file log-handle.cpp.

38 { return Log(strMessage); }

References Log().

Here is the call graph for this function:

Variable Documentation

◆ first_log

std::string first_log

Definition at line 21 of file log-handle.cpp.

Referenced by c4_log_handle_clear(), c4_log_handle_get_first_log_message(), and Log().

◆ n_logs

unsigned int n_logs = 0

Definition at line 22 of file log-handle.cpp.

Referenced by c4_log_handle_clear(), c4_log_handle_get_n_log_messages(), and Log().