Browse Source

log: Change log_dateformat to log_show_date and make it bool.

nfactor-troky
Noel Maersk 11 years ago
parent
commit
f6f950273b
  1. 10
      cgminer.c
  2. 7
      logging.c
  3. 2
      logging.h

10
cgminer.c

@ -1073,14 +1073,14 @@ static struct opt_table opt_config_table[] = { @@ -1073,14 +1073,14 @@ static struct opt_table opt_config_table[] = {
set_kernel, NULL, NULL,
"Override kernel to use - one value or comma separated"),
OPT_WITHOUT_ARG("--load-balance",
set_loadbalance, &pool_strategy,
"Change multipool strategy from failover to quota based balance"),
set_loadbalance, &pool_strategy,
"Change multipool strategy from failover to quota based balance"),
OPT_WITH_ARG("--log|-l",
set_int_0_to_9999, opt_show_intval, &opt_log_interval,
"Interval in seconds between log output"),
OPT_WITH_ARG("--log-dateformat",
set_int_0_to_10, opt_show_intval, &opt_log_dateformat,
"Set log dateformat (0 or 1) - 0 is time only, 1 is full date and time."),
OPT_WITHOUT_ARG("--log-show-date|-L",
opt_set_bool, &opt_log_show_date,
"Show date on every log line"),
OPT_WITHOUT_ARG("--lowmem",
opt_set_bool, &opt_lowmem,
"Minimise caching of shares for low memory applications"),

7
logging.c

@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
bool opt_debug = false;
bool opt_log_output = false;
int last_date_output_day = 0;
int opt_log_dateformat = 0;
int opt_log_show_date = false;
/* per default priorities higher than LOG_NOTICE are logged */
int opt_log_level = LOG_NOTICE;
@ -71,7 +71,8 @@ void _applog(int prio, const char *str, bool force) @@ -71,7 +71,8 @@ void _applog(int prio, const char *str, bool force)
const time_t tmp_time = tv.tv_sec;
tm = localtime(&tmp_time);
if ((opt_log_dateformat == 0) && (last_date_output_day != tm->tm_mday))
/* Day changed. */
if (opt_log_show_date && (last_date_output_day != tm->tm_mday))
{
last_date_output_day = tm->tm_mday;
char date_output_str[64];
@ -83,7 +84,7 @@ void _applog(int prio, const char *str, bool force) @@ -83,7 +84,7 @@ void _applog(int prio, const char *str, bool force)
}
if (opt_log_dateformat == 1)
if (opt_log_show_date)
{
snprintf(datetime, sizeof(datetime), " [%d-%02d-%02d %02d:%02d:%02d] ",
tm->tm_year + 1900,

2
logging.h

@ -26,7 +26,7 @@ extern bool want_per_device_stats; @@ -26,7 +26,7 @@ extern bool want_per_device_stats;
/* global log_level, messages with lower or equal prio are logged */
extern int opt_log_level;
extern int opt_log_dateformat;
extern int opt_log_show_date;
#define LOGBUFSIZ 256

Loading…
Cancel
Save