The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Typedefs | Functions | Variables
lg Namespace Reference

Classes

class  log_domain
 
class  logger
 
class  redirect_output_setter
 Helper class to redirect the output of the logger in a certain scope. More...
 
class  scope_logger
 

Typedefs

typedef std::map< std::string,
int > 
domain_map
 
typedef std::pair< const
std::string, int > 
logd
 

Functions

void timestamps (bool t)
 
void precise_timestamps (bool pt)
 
loggererr ()
 
loggerwarn ()
 
loggerinfo ()
 
loggerdebug ()
 
log_domaingeneral ()
 
bool set_log_domain_severity (const std::string &name, int severity)
 
bool set_log_domain_severity (const std::string &name, const logger &lg)
 
bool get_log_domain_severity (const std::string &name, int &severity)
 
std::string list_logdomains (const std::string &filter)
 
void set_strict_severity (int severity)
 
void set_strict_severity (const logger &lg)
 
bool broke_strict ()
 
std::string get_timestamp (const time_t &t, const std::string &format)
 
std::string get_timespan (const time_t &t)
 
static void print_precise_timestamp (std::ostream &out) NOEXCEPT
 
std::stringstream & wml_error ()
 Use this logger to send errors due to deprecated WML. More...
 
std::string log_file_path ()
 Returns the path to the current log file. More...
 
void early_log_file_setup ()
 Sets up the initial temporary log file. More...
 
void enable_native_console_output ()
 Switches to using a native console instead of log file redirection. More...
 
bool using_own_console ()
 Returns true if a console was allocated by the Wesnoth process. More...
 
void finish_log_file_setup ()
 Relocates the stdout+stderr log file to the user data directory. More...
 

Variables

static domain_mapdomains
 
static int strict_level_ = -1
 
static log_domain dom ("general")
 
static bool strict_threw_ = false
 

Typedef Documentation

typedef std::map<std::string, int> lg::domain_map

Definition at line 73 of file log.cpp.

typedef std::pair<const std::string, int> lg::logd

Definition at line 95 of file log.hpp.

Function Documentation

bool lg::broke_strict ( )

Definition at line 171 of file log.cpp.

References strict_threw_.

Referenced by game_launcher::unit_test().

logger & lg::debug ( )
void lg::early_log_file_setup ( )

Sets up the initial temporary log file.

This has to be done on demand (preferably as early as possible) from a function rather than during static initialization, otherwise things go horribly wrong as soon as we try to use the logging facilities internally for debug messages.

Definition at line 465 of file log_windows.cpp.

Referenced by finish_log_file_setup(), and main().

void lg::enable_native_console_output ( )

Switches to using a native console instead of log file redirection.

In this mode, the log file is closed (if it was created in the first place) and output is sent directly to an attached or allocated console instead. This is used to implement the –wconsole command line option.

Using a native console instead of a file has the benefit of allowing to see output in real time or redirecting it to a user-specified file.

Definition at line 474 of file log_windows.cpp.

Referenced by main().

logger & lg::err ( )
void lg::finish_log_file_setup ( )

Relocates the stdout+stderr log file to the user data directory.

This function exits the process if something goes wrong (including calling it when the user data directory isn't known yet).

Definition at line 489 of file log_windows.cpp.

References early_log_file_setup(), ERR_LS, filesystem::file_exists(), filesystem::get_user_data_dir(), and filesystem::make_directory().

Referenced by filesystem::setup_user_data_dir().

log_domain & lg::general ( )
bool lg::get_log_domain_severity ( const std::string &  name,
int &  severity 
)

Definition at line 142 of file log.cpp.

Referenced by gui2::dialogs::log_settings::pre_show().

std::string lg::get_timespan ( const time_t &  t)

Definition at line 182 of file log.cpp.

Referenced by wesnothd::banned::get_human_time_span().

std::string lg::get_timestamp ( const time_t &  t,
const std::string &  format 
)
logger & lg::info ( )
std::string lg::list_logdomains ( const std::string &  filter)

Definition at line 151 of file log.cpp.

Referenced by gui2::dialogs::log_settings::log_settings(), and process_command_args().

std::string lg::log_file_path ( )

Returns the path to the current log file.

An empty string is returned if the log file has not been set up yet or it was disabled (e.g. by –wconsole).

Definition at line 456 of file log_windows.cpp.

void lg::precise_timestamps ( bool  pt)

Definition at line 77 of file log.cpp.

References precise_timestamp.

Referenced by process_command_args().

static void lg::print_precise_timestamp ( std::ostream &  out)
static

Definition at line 199 of file log.cpp.

References facet().

Referenced by lg::logger::operator()().

bool lg::set_log_domain_severity ( const std::string &  name,
int  severity 
)
bool lg::set_log_domain_severity ( const std::string &  name,
const logger &  lg 
)

Definition at line 138 of file log.cpp.

References lg::logger::get_severity(), and set_log_domain_severity().

void lg::set_strict_severity ( int  severity)

Definition at line 161 of file log.cpp.

Referenced by commandline_options::parse_log_strictness(), and set_strict_severity().

void lg::set_strict_severity ( const logger &  lg)

Definition at line 165 of file log.cpp.

References lg::logger::get_severity(), and set_strict_severity().

void lg::timestamps ( bool  t)

Definition at line 76 of file log.cpp.

References t, and timestamp.

Referenced by BOOST_AUTO_TEST_CASE(), and main().

bool lg::using_own_console ( )

Returns true if a console was allocated by the Wesnoth process.

Returns false if no native console or if it was attached from a parent process.

Definition at line 484 of file log_windows.cpp.

logger & lg::warn ( )
std::stringstream & lg::wml_error ( )

Variable Documentation

log_domain lg::dom("general")
static

Referenced by general().

domain_map* lg::domains
static

Definition at line 74 of file log.cpp.

Referenced by commandline_options::parse_log_domains_().

int lg::strict_level_ = -1
static

Definition at line 75 of file log.cpp.

bool lg::strict_threw_ = false
static

Definition at line 169 of file log.cpp.

Referenced by broke_strict().