UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
sv_log.cpp File Reference

game lib logging handling More...

#include "server.h"
#include "sv_log.h"
#include "../shared/stringhunk.h"
#include <SDL_thread.h>

Go to the source code of this file.

Functions

static void SV_LogPrintOutput (const char *string)
 
void SV_LogHandleOutput (void)
 Handle the log output from the main thread by reading the strings from the dbuffer the game lib thread has written into. More...
 
void SV_LogAdd (const char *format, va_list ap)
 Async version to add a log entry for the game lib. More...
 
void SV_LogInit (void)
 
void SV_LogShutdown (void)
 

Variables

static SDL_mutex * svLogMutex
 
static stringHunk_tsvLogHunk
 

Detailed Description

game lib logging handling

Note
we need this because the game lib logic can run in a separate thread and could cause some systems to hang if we would use Com_Printf indirectly

Definition in file sv_log.cpp.

Function Documentation

void SV_LogAdd ( const char *  format,
va_list  ap 
)

Async version to add a log entry for the game lib.

Note
This is needed because using Com_Printf from within the game lib thread might freeze some systems as the console print functions are not thread safe.
Parameters
formatThe format of the message
apThe variadic function argument list to fill the format strings

Definition at line 60 of file sv_log.cpp.

References Q_vsnprintf(), STRHUNK_Add(), and svLogMutex.

Referenced by SV_dprintf(), and SV_PlayerPrintf().

void SV_LogHandleOutput ( void  )

Handle the log output from the main thread by reading the strings from the dbuffer the game lib thread has written into.

Definition at line 44 of file sv_log.cpp.

References STRHUNK_Reset(), STRHUNK_Visit(), SV_LogPrintOutput(), and svLogMutex.

Referenced by SV_Frame().

void SV_LogInit ( void  )

Definition at line 71 of file sv_log.cpp.

References STRHUNK_Create(), and svLogMutex.

Referenced by SV_Init().

static void SV_LogPrintOutput ( const char *  string)
static

Definition at line 35 of file sv_log.cpp.

References Com_Printf().

Referenced by SV_LogHandleOutput().

void SV_LogShutdown ( void  )

Definition at line 78 of file sv_log.cpp.

References STRHUNK_Delete(), and svLogMutex.

Referenced by SV_Clear().

Variable Documentation

stringHunk_t* svLogHunk
static

Definition at line 33 of file sv_log.cpp.

SDL_mutex* svLogMutex
static

Definition at line 32 of file sv_log.cpp.

Referenced by SV_LogAdd(), SV_LogHandleOutput(), SV_LogInit(), and SV_LogShutdown().