41#define CLAW_MK_STR_(e) #e
47#define CLAW_MK_STR(e) CLAW_MK_STR_(e)
59 : m_arguments( argc, argv )
61 setlocale( LC_ALL,
"" );
62#ifdef CLAW_TEXT_DOMAIN_PATH
63 bindtextdomain(
"libclaw",
CLAW_MK_STR(CLAW_TEXT_DOMAIN_PATH) );
65 bind_textdomain_codeset(
"libclaw",
"UTF-8" );
66 textdomain(
"libclaw");
69 (
"--log-file",
claw_gettext(
"The file to use to store log information."),
74 "\t\terror: error messages,\n"
75 "\t\twarning: warning and error messages,\n"
76 "\t\tverbose: all messages."),
true,
claw_gettext(
"string") );
80 (
"Use a logger that does not output successively the same message."),
85 (
"Use a logger that does not output messages that have been recently"
112 if ( (level ==
"error") || (level ==
claw_gettext(
"error")) )
114 else if ( (level ==
"warning") || (level ==
claw_gettext(
"warning")) )
116 else if ( (level ==
"verbose") || (level ==
claw_gettext(
"verbose")) )
#define CLAW_MK_STR(e)
Build a char[] string representing an expression.
A class to represent the application.
application(int &argc, char **&argv)
Constructor.
arguments_table m_arguments
The arguments passed by the system.
virtual ~application()
Destructor.
const std::string & get_string(const std::string &arg_name) const
Get the string value of an argument.
bool has_value(const std::string &arg_name) const
Tell if an argument has a value.
bool only_integer_values(const std::string &arg_name) const
Tell if only integer values are associated to an argument.
int get_integer(const std::string &arg_name) const
Get the integer value of an argument.
void add_long(const std::string &long_name, const std::string &help_msg="", bool optional=false, const std::string &val_name="")
Add an argument in the table.
void parse(int &argc, char **&argv)
Parse the command line arguments.
bool get_bool(const std::string &arg_name) const
Get the boolean state of an argument.
This class write log messages in std::clog.
This class write log messages in a file.
A log stream that does not output a message that have been recently output.
A log stream that does not output successively the same message.
Base class for streams accepting log output.
CLAW_LOGGER_EXPORT void clear()
Delete the streams.
CLAW_LOGGER_EXPORT void set_level(int lvl)
Change the level of log.
CLAW_LOGGER_EXPORT void set(stream_type *s)
Set the output stream.
Macros to call gettext on the libclaw textdomain.
#define claw_gettext(s)
Call gettext on the default text domain used by Claw.
A log stream that does not output a message that have been recently output.
A log stream that does not output successively the same message.
Some basic classes for logging.
log_level log_verbose(15)
Use this level if you want to inform the user about a situation that is not problematic.
log_system logger
The default log system provided by claw.
log_level log_warning(1, "warning: ")
Use this level if a small problem occurs and you can deal with it without crashing the application.
log_level log_error(0, "error: ")
Use this level if something goes really bad and your application may crash.