mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-31 08:54:19 +00:00
log: Change log_dateformat to log_show_date and make it bool.
This commit is contained in:
parent
ba1c47781f
commit
f6f950273b
10
cgminer.c
10
cgminer.c
@ -1073,14 +1073,14 @@ static struct opt_table opt_config_table[] = {
|
|||||||
set_kernel, NULL, NULL,
|
set_kernel, NULL, NULL,
|
||||||
"Override kernel to use - one value or comma separated"),
|
"Override kernel to use - one value or comma separated"),
|
||||||
OPT_WITHOUT_ARG("--load-balance",
|
OPT_WITHOUT_ARG("--load-balance",
|
||||||
set_loadbalance, &pool_strategy,
|
set_loadbalance, &pool_strategy,
|
||||||
"Change multipool strategy from failover to quota based balance"),
|
"Change multipool strategy from failover to quota based balance"),
|
||||||
OPT_WITH_ARG("--log|-l",
|
OPT_WITH_ARG("--log|-l",
|
||||||
set_int_0_to_9999, opt_show_intval, &opt_log_interval,
|
set_int_0_to_9999, opt_show_intval, &opt_log_interval,
|
||||||
"Interval in seconds between log output"),
|
"Interval in seconds between log output"),
|
||||||
OPT_WITH_ARG("--log-dateformat",
|
OPT_WITHOUT_ARG("--log-show-date|-L",
|
||||||
set_int_0_to_10, opt_show_intval, &opt_log_dateformat,
|
opt_set_bool, &opt_log_show_date,
|
||||||
"Set log dateformat (0 or 1) - 0 is time only, 1 is full date and time."),
|
"Show date on every log line"),
|
||||||
OPT_WITHOUT_ARG("--lowmem",
|
OPT_WITHOUT_ARG("--lowmem",
|
||||||
opt_set_bool, &opt_lowmem,
|
opt_set_bool, &opt_lowmem,
|
||||||
"Minimise caching of shares for low memory applications"),
|
"Minimise caching of shares for low memory applications"),
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
bool opt_debug = false;
|
bool opt_debug = false;
|
||||||
bool opt_log_output = false;
|
bool opt_log_output = false;
|
||||||
int last_date_output_day = 0;
|
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 */
|
/* per default priorities higher than LOG_NOTICE are logged */
|
||||||
int opt_log_level = LOG_NOTICE;
|
int opt_log_level = LOG_NOTICE;
|
||||||
@ -71,7 +71,8 @@ void _applog(int prio, const char *str, bool force)
|
|||||||
const time_t tmp_time = tv.tv_sec;
|
const time_t tmp_time = tv.tv_sec;
|
||||||
tm = localtime(&tmp_time);
|
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;
|
last_date_output_day = tm->tm_mday;
|
||||||
char date_output_str[64];
|
char date_output_str[64];
|
||||||
@ -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] ",
|
snprintf(datetime, sizeof(datetime), " [%d-%02d-%02d %02d:%02d:%02d] ",
|
||||||
tm->tm_year + 1900,
|
tm->tm_year + 1900,
|
||||||
|
@ -26,7 +26,7 @@ extern bool want_per_device_stats;
|
|||||||
/* global log_level, messages with lower or equal prio are logged */
|
/* global log_level, messages with lower or equal prio are logged */
|
||||||
extern int opt_log_level;
|
extern int opt_log_level;
|
||||||
|
|
||||||
extern int opt_log_dateformat;
|
extern int opt_log_show_date;
|
||||||
|
|
||||||
#define LOGBUFSIZ 256
|
#define LOGBUFSIZ 256
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user