Freeciv21
Develop your civilization from humble roots to a global empire
log.cpp File Reference
#include <fc_config.h>
#include <vector>
#include <QFileInfo>
#include <QLoggingCategory>
#include <QMutexLocker>
#include <QString>
#include "fcintl.h"
#include "shared.h"
#include "log.h"
+ Include dependency graph for log.cpp:

Go to the source code of this file.

Functions

bool log_init (const QString &level_str, const QStringList &extra_rules)
 Parses a log level string as provided by the user on the command line, and installs the corresponding Qt log filters. More...
 
void log_set_file (const QString &path)
 Redirects the log to a file. More...
 
const QString & log_get_level ()
 Retrieves the log level passed to log_init (even if log_init failed). More...
 
void log_close ()
 Deinitialize logging module. More...
 
void fc_assert_set_fatal (bool fatal)
 Set what signal the assert* macros should raise on failed assertion (-1 to disable). More...
 
bool fc_assert_are_fatal ()
 Checks whether the fc_assert* macros should raise on failed assertion. More...
 
void fc_assert_handle_failure (const char *condition, const char *file, int line, const char *function, const QString &message)
 Handles a failed assertion. More...
 
void log_time (const QString &msg, bool log)
 

Function Documentation

◆ fc_assert_are_fatal()

bool fc_assert_are_fatal ( )

Checks whether the fc_assert* macros should raise on failed assertion.

Definition at line 231 of file log.cpp.

Referenced by fc_assert_handle_failure().

◆ fc_assert_handle_failure()

void fc_assert_handle_failure ( const char *  condition,
const char *  file,
int  line,
const char *  function,
const QString &  message 
)

Handles a failed assertion.

Definition at line 236 of file log.cpp.

◆ fc_assert_set_fatal()

void fc_assert_set_fatal ( bool  fatal)

Set what signal the assert* macros should raise on failed assertion (-1 to disable).

Definition at line 226 of file log.cpp.

Referenced by client_main(), main(), re_parse_cmdline(), and rup_parse_cmdline().

◆ log_close()

void log_close ( )

Deinitialize logging module.

Definition at line 212 of file log.cpp.

Referenced by client_exit(), con_log_close(), fcmp_deinit(), and main().

◆ log_get_level()

const QString& log_get_level ( )

Retrieves the log level passed to log_init (even if log_init failed).

This can be overridden from the environment, so it's only useful when passing it to the server from the client.

Definition at line 207 of file log.cpp.

Referenced by client_start_server().

◆ log_init()

bool log_init ( const QString &  level_str,
const QStringList &  extra_rules 
)

Parses a log level string as provided by the user on the command line, and installs the corresponding Qt log filters.

Prints a warning and returns false if the log level name isn't known.

Additional logging rules can be passed in Qt format.

Definition at line 55 of file log.cpp.

Referenced by client_main(), fcmp_parse_cmdline(), and main().

◆ log_set_file()

void log_set_file ( const QString &  path)

Redirects the log to a file.

It will still be shown on standard error. This function is not thread-safe.

Definition at line 177 of file log.cpp.

Referenced by client_main(), and con_log_init().

◆ log_time()

void log_time ( const QString &  msg,
bool  log 
)