NAME
gc_log_setopt - sets the logging options in the Game Carrier Framework.
SYNOPSIS
#include <game-carrier/client.h>
GC_CLIENT_API
void gc_log_setopt(
GCT_INT level,
GCT_CSTR file_name,
GCT_INT flags);
Parameters:
levelGCT_INTSets the logging level.file_nameGCT_CSTRFilename where the logs will be saved.flagsGCT_INTSpecifies the logging flags.
RETURN VALUE
None.
DESCRIPTION
The gc_log_setopt operation is used to set logging options in the
Game Carrier framework. To set custom logging you must specify corresponding
flags in the invocation and also invoke this function before initialization
of the framework. Otherwise, the logging is automatically set to default options.
The level parameter sets the logging level to determine the severity of logs
to be generated. Flags passed to the function must be separated by bitwise OR
operator. You can easily combine any flags in the invocation.
Supported values: GCL_NORMAL, GCL_VERBOSE,
GCL_ERR, GCL_WARN, GCL_NOTICE, GCL_INFO, GCL_DEBUG, GCL_USER.
The GCL_NORMAL flag represents the following combination of
flags: GCL_ERR, GCL_WARN, GCL_NOTICE, GCL_USER. The GCL_VERBOSE flag
sets the maximum logging level and it is a combination of all available flags.
The file_name parameter specifies the filename where the logs
will be saved. Supported values: NULL or "" which stands
for an empty string.
If NULL is used in the invocation, then the naming convention
of the log file is ``gc_client.%p.log. Where %p is the placeholder
for the process ID number. In case an empty string "" is used
in the invocation, then no logs are written to the file.
The flags parameter specifies the logging flags, whose value is a bitwise OR.
Supported values: GCL_STANDARD_FLAGS, GCL_TO_STDERR,
GCL_PRINT_THREAD_ID, GCL_AUTO_FLUSH, GCL_APPEND.
The GCL_STANDARD_FLAGS flag represents the following combination of flags:
GCL_TO_STDERRoutputs the log messages to thestderrstream.GCL_PRINT_THREAD_IDadds a thread ID to a log message.GCL_AUTO_FLUSHallows writing changes to the log file right after each invocation. This flag affects performance, but when the program crashes, all details are saved to the log file.GCL_APPENDflag is used to preserve a log file between runs. New log messages will be appended to the end of the existing file.
EXAMPLE
#include <game-carrier/client.h>
int main(int argc, char * argv[])
{
gc_log_setopt(GCL_ERR | GCL_WARN | GCL_NOTICE, "game.%p.log", GCL_TO_STDERR);
gc_clients_init(GC_MODE_HYBRID);
/* Continue working... */
return 0;
}