Freeciv-3.1
|
Go to the source code of this file.
Macros | |
#define | MAX_LEN_LOG_LINE 5120 |
#define | __FC_LINE__ __LINE__ |
#define | NOLOGMSG nologmsg |
#define | log_do_output_for_level(level) (log_get_level() >= level) |
#define | log_base(level, message, ...) |
#define | log_fatal(message, ...) |
#define | log_error(message, ...) log_base(LOG_ERROR, message, ## __VA_ARGS__) |
#define | log_warn(message, ...) log_base(LOG_WARN, message, ## __VA_ARGS__) |
#define | log_normal(message, ...) log_base(LOG_NORMAL, message, ## __VA_ARGS__) |
#define | log_verbose(message, ...) log_base(LOG_VERBOSE, message, ## __VA_ARGS__) |
#define | log_debug(message, ...) /* Do nothing. */ |
#define | log_testmatic(message, ...) /* Do nothing. */ |
#define | log_testmatic_alt(altlvl, message, ...) log_base(altlvl, message, ## __VA_ARGS__) |
#define | log_va_list(level, msg, args) |
#define | log_test log_normal |
#define | log_packet log_verbose |
#define | log_packet_detailed log_debug |
#define | LOG_TEST LOG_NORMAL /* needed by citylog_*() functions */ |
#define | fc_assert_full(file, function, line, condition, action, message, ...) |
#define | fc_assert(condition) |
#define | fc_assert_msg(condition, message, ...) |
#define | fc_assert_action(condition, action) |
#define | fc_assert_ret(condition) fc_assert_action(condition, return) |
#define | fc_assert_ret_val(condition, val) fc_assert_action(condition, return val) |
#define | fc_assert_exit(condition) fc_assert_action(condition, exit(EXIT_FAILURE)) |
#define | fc_assert_action_msg(condition, action, message, ...) |
#define | fc_assert_ret_msg(condition, message, ...) fc_assert_action_msg(condition, return, message, ## __VA_ARGS__) |
#define | fc_assert_ret_val_msg(condition, val, message, ...) fc_assert_action_msg(condition, return val, message, ## __VA_ARGS__) |
#define | fc_assert_exit_msg(condition, message, ...) |
#define | FC_STATIC_STRLEN_ASSERT(cond, tag) |
#define | FC_STATIC_ASSERT(cond, tag) enum { static_assert_ ## tag = 1 / (!!(cond)) } |
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 } |
Functions | |
void | log_init (const char *filename, enum log_level initial_level, log_callback_fn callback, log_prefix_fn prefix, int fatal_assertions) |
void | log_close (void) |
bool | log_parse_level_str (const char *level_str, enum log_level *ret_level) |
log_pre_callback_fn | log_set_pre_callback (log_pre_callback_fn precallback) |
log_callback_fn | log_set_callback (log_callback_fn callback) |
log_prefix_fn | log_set_prefix (log_prefix_fn prefix) |
void | log_set_level (enum log_level level) |
enum log_level | log_get_level (void) |
const char * | log_level_name (enum log_level lvl) |
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) |
void | do_log (const char *file, const char *function, int line, bool print_from_where, enum log_level level, const char *message,...) fc__attribute((__format__(__printf__ |
void | fc_assert_set_fatal (int fatal_assertions) |
void | fc_assert_fail (const char *file, const char *function, int line, const char *assertion, const char *message,...) fc__attribute((__format__(__printf__ |
Variables | |
const char * | nologmsg |
#define fc_assert | ( | condition | ) |
#define fc_assert_action | ( | condition, | |
action | |||
) |
#define fc_assert_exit | ( | condition | ) | fc_assert_action(condition, exit(EXIT_FAILURE)) |
#define fc_assert_exit_msg | ( | condition, | |
message, | |||
... | |||
) |
#define fc_assert_msg | ( | condition, | |
message, | |||
... | |||
) |
#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_fatal | ( | message, | |
... | |||
) |
#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_va_list | ( | level, | |
msg, | |||
args | |||
) |
#define log_verbose | ( | message, | |
... | |||
) | log_base(LOG_VERBOSE, message, ## __VA_ARGS__) |
enum log_level |
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, | ||
... | |||
) |
void fc_assert_set_fatal | ( | int | fatal_assertions | ) |
void log_close | ( | void | ) |
Deinitialize logging module.
Definition at line 270 of file log.c.
Referenced by client_exit(), con_log_close(), fcmp_deinit(), and main().
enum log_level log_get_level | ( | void | ) |
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 NULL. If both are NULL, print to stderr. If both are non-NULL, 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(), and main().
const char * log_level_name | ( | enum log_level | lvl | ) |
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(), and main().
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().
void log_set_level | ( | enum log_level | level | ) |
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().