log: added log_early_init() for early debug messages
This commit is contained in:
parent
84437acffb
commit
0a0736fc4e
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "cmdline.h"
|
#include "cmdline.h"
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
|
#include "log.h"
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "decoder_list.h"
|
#include "decoder_list.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@ -123,6 +124,10 @@ void parseOptions(int argc, char **argv, Options *options)
|
|||||||
if (option_version)
|
if (option_version)
|
||||||
version();
|
version();
|
||||||
|
|
||||||
|
/* initialize the logging library, so the configuration file
|
||||||
|
parser can use it already */
|
||||||
|
log_early_init(options->verbose);
|
||||||
|
|
||||||
if (option_create_db && option_no_create_db)
|
if (option_create_db && option_no_create_db)
|
||||||
g_error("Cannot use both --create-db and --no-create-db\n");
|
g_error("Cannot use both --create-db and --no-create-db\n");
|
||||||
|
|
||||||
|
@ -217,6 +217,15 @@ parse_log_level(const char *value, unsigned line)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
log_early_init(bool verbose)
|
||||||
|
{
|
||||||
|
if (verbose)
|
||||||
|
log_threshold = G_LOG_LEVEL_DEBUG;
|
||||||
|
|
||||||
|
log_init_stdout();
|
||||||
|
}
|
||||||
|
|
||||||
void log_init(bool verbose, bool use_stdout)
|
void log_init(bool verbose, bool use_stdout)
|
||||||
{
|
{
|
||||||
const struct config_param *param;
|
const struct config_param *param;
|
||||||
|
11
src/log.h
11
src/log.h
@ -25,6 +25,17 @@
|
|||||||
G_GNUC_PRINTF(1, 2) void DEBUG(const char *fmt, ...);
|
G_GNUC_PRINTF(1, 2) void DEBUG(const char *fmt, ...);
|
||||||
G_GNUC_PRINTF(1, 2) G_GNUC_NORETURN void FATAL(const char *fmt, ...);
|
G_GNUC_PRINTF(1, 2) G_GNUC_NORETURN void FATAL(const char *fmt, ...);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure a logging destination for daemon startup, before the
|
||||||
|
* configuration file is read. This allows the daemon to use the
|
||||||
|
* logging library (and the command line verbose level) before it's
|
||||||
|
* daemonized.
|
||||||
|
*
|
||||||
|
* @param verbose true when the program is started with --verbose
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
log_early_init(bool verbose);
|
||||||
|
|
||||||
void log_init(bool verbose, bool use_stdout);
|
void log_init(bool verbose, bool use_stdout);
|
||||||
|
|
||||||
void setup_log_output(bool use_stdout);
|
void setup_log_output(bool use_stdout);
|
||||||
|
Loading…
Reference in New Issue
Block a user