Freeciv-3.3
|
Go to the source code of this file.
Typedefs | |
typedef void(* | log_pre_callback_fn) (enum log_level, bool print_from_where, const char *where, const char *msg) |
typedef void(* | log_callback_fn) (enum log_level, const char *, bool file_too) |
typedef const char *(* | log_prefix_fn) (void) |
Enumerations | |
enum | log_level { LOG_FATAL = 0 , LOG_ERROR , LOG_WARN , LOG_NORMAL , LOG_VERBOSE , LOG_DEBUG } |
Variables | |
const char * | nologmsg |
#define fc_assert | ( | condition | ) |
#define fc_assert_exit | ( | condition | ) | fc_assert_action(condition, exit(EXIT_FAILURE)) |
#define fc_assert_ret | ( | condition | ) | fc_assert_action(condition, return) |
#define fc_assert_ret_msg | ( | condition, | |
message, | |||
... | |||
) | fc_assert_action_msg(condition, return, message, ## __VA_ARGS__) |
#define fc_assert_ret_val | ( | condition, | |
val | |||
) | fc_assert_action(condition, return val) |
#define fc_assert_ret_val_msg | ( | condition, | |
val, | |||
message, | |||
... | |||
) | fc_assert_action_msg(condition, return val, message, ## __VA_ARGS__) |
#define FC_STATIC_ASSERT | ( | cond, | |
tag | |||
) | enum { static_assert_ ## tag = 1 / (!!(cond)) } |
#define log_do_output_for_level | ( | level | ) | (log_get_level() >= level) |
#define log_normal | ( | message, | |
... | |||
) | log_base(LOG_NORMAL, message, ## __VA_ARGS__) |
#define log_packet log_verbose |
#define log_test log_normal |
#define LOG_TEST LOG_NORMAL /* needed by citylog_*() functions */ |
#define log_verbose | ( | message, | |
... | |||
) | log_base(LOG_VERBOSE, message, ## __VA_ARGS__) |
void do_log | ( | const char * | file, |
const char * | function, | ||
int | line, | ||
bool | print_from_where, | ||
enum log_level | level, | ||
const char * | message, | ||
... | |||
) |
void fc_assert_fail | ( | const char * | file, |
const char * | function, | ||
int | line, | ||
const char * | assertion, | ||
const char * | message, | ||
... | |||
) |
Deinitialize logging module.
Definition at line 270 of file log.c.
Referenced by client_exit(), con_log_close(), fcmp_deinit(), and main().
Returns the current log level.
Definition at line 322 of file log.c.
Referenced by client_start_server().
void log_init | ( | const char * | filename, |
enum log_level | initial_level, | ||
log_callback_fn | callback, | ||
log_prefix_fn | prefix, | ||
int | fatal_assertions | ||
) |
Initialise the log module. Either 'filename' or 'callback' may be nullptr. If both are nullptr, print to stderr. If neither is nullptr, both callback, and fprintf to file. Pass -1 for fatal_assertions to don't raise any signal on failed assertion.
Definition at line 245 of file log.c.
Referenced by client_main(), con_log_init(), fcmp_parse_cmdline(), main(), and re_parse_cmdline().
Return name of the given log level
Definition at line 330 of file log.c.
Referenced by client_start_server().
level_str should be either "0", "1", "2", "3", "4" or "4:filename" or "4:file1:file2" or "4:filename,100,200" etc
If everything goes ok, returns TRUE. If there was a parsing problem, prints to stderr, and returns FALSE.
Return in ret_level the requested level only if level_str is a simple number (like "0", "1", "2").
Also sets up the log_files data structure. Does not set fc_log_level.
Definition at line 86 of file log.c.
Referenced by client_main(), fcmp_parse_cmdline(), main(), main(), and re_parse_cmdline().
log_callback_fn log_set_callback | ( | log_callback_fn | callback | ) |
Adjust the callback function after initial log_init().
Definition at line 290 of file log.c.
Referenced by ui_init().
Adjust the logging level after initial log_init().
log_pre_callback_fn log_set_pre_callback | ( | log_pre_callback_fn | precallback | ) |
Adjust the log preparation callback function.
Definition at line 278 of file log.c.
Referenced by backtrace_deinit(), and backtrace_init().
log_prefix_fn log_set_prefix | ( | log_prefix_fn | prefix | ) |
Adjust the prefix callback function after initial log_init().
void vdo_log | ( | const char * | file, |
const char * | function, | ||
int | line, | ||
bool | print_from_where, | ||
enum log_level | level, | ||
char * | buf, | ||
int | buflen, | ||
const char * | message, | ||
va_list | args | ||
) |
Unconditionally print a log message. This function is usually protected by do_log_for().
Definition at line 403 of file log.c.
Referenced by bugreport_request(), do_log(), do_log_deprecation(), fc_assert_fail(), and ruleset_error_real().