Skip to content

Commit

Permalink
logging: log_date_format ==> log_timestamp_format
Browse files Browse the repository at this point in the history
Lets name the option LogTimestampFormat as that is what it actually is
more then just a date or time.
  • Loading branch information
Marco van Wieringen committed Jan 1, 2016
1 parent 2430440 commit 7ac3596
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 28 deletions.
4 changes: 2 additions & 2 deletions src/dird/dird.c
Expand Up @@ -1003,8 +1003,8 @@ static bool check_resources()
if (me->secure_erase_cmdline) {
set_secure_erase_cmdline(me->secure_erase_cmdline);
}
if (me->log_date_format) {
set_log_date_format(me->log_date_format);
if (me->log_timestamp_format) {
set_log_timestamp_format(me->log_timestamp_format);
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/dird/dird_conf.c
Expand Up @@ -147,7 +147,7 @@ static RES_ITEM dir_items[] = {
{ "Auditing", CFG_TYPE_BOOL, ITEM(res_dir.auditing), 0, CFG_ITEM_DEFAULT, "false", "14.2.0-", NULL },
{ "AuditEvents", CFG_TYPE_AUDIT, ITEM(res_dir.audit_events), 0, 0, NULL, "14.2.0-", NULL },
{ "SecureEraseCommand", CFG_TYPE_STR, ITEM(res_dir.secure_erase_cmdline), 0, 0, NULL, "15.2.1-", NULL },
{ "LogDateFormat", CFG_TYPE_STR, ITEM(res_dir.log_date_format), 0, 0, NULL, NULL, NULL },
{ "LogTimestampFormat", CFG_TYPE_STR, ITEM(res_dir.log_timestamp_format), 0, 0, NULL, "15.2.3-", NULL },
{ NULL, 0, { 0 }, 0, 0, NULL, NULL, NULL }
};

Expand Down Expand Up @@ -2397,8 +2397,8 @@ void free_resource(RES *sres, int type)
if (res->res_dir.secure_erase_cmdline) {
free(res->res_dir.secure_erase_cmdline);
}
if (res->res_dir.log_date_format) {
free(res->res_dir.log_date_format);
if (res->res_dir.log_timestamp_format) {
free(res->res_dir.log_timestamp_format);
}
break;
case R_DEVICE:
Expand Down
2 changes: 1 addition & 1 deletion src/dird/dird_conf.h
Expand Up @@ -146,7 +146,7 @@ class DIRRES: public BRSRES {
uint32_t stats_collect_interval; /* Statistics collect interval in seconds */
char *verid; /* Custom Id to print in version command */
char *secure_erase_cmdline; /* Cmdline to execute to perform secure erase of file */
char *log_date_format; /* Date format to use in generic logging messages */
char *log_timestamp_format; /* Timestamp format to use in generic logging messages */
s_password keyencrkey; /* Key Encryption Key */
};

Expand Down
4 changes: 2 additions & 2 deletions src/filed/filed.c
Expand Up @@ -603,8 +603,8 @@ static bool check_resources()
if (me->secure_erase_cmdline) {
set_secure_erase_cmdline(me->secure_erase_cmdline);
}
if (me->log_date_format) {
set_log_date_format(me->log_date_format);
if (me->log_timestamp_format) {
set_log_timestamp_format(me->log_timestamp_format);
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/filed/filed_conf.c
Expand Up @@ -122,7 +122,7 @@ static RES_ITEM cli_items[] = {
{ "AlwaysUseLmdb", CFG_TYPE_BOOL, ITEM(res_client.always_use_lmdb), 0, CFG_ITEM_DEFAULT, "false", NULL, NULL },
{ "LmdbThreshold", CFG_TYPE_PINT32, ITEM(res_client.lmdb_threshold), 0, 0, NULL, NULL, NULL },
{ "SecureEraseCommand", CFG_TYPE_STR, ITEM(res_client.secure_erase_cmdline), 0, 0, NULL, NULL, NULL },
{ "LogDateFormat", CFG_TYPE_STR, ITEM(res_client.log_date_format), 0, 0, NULL, NULL, NULL },
{ "LogTimestampFormat", CFG_TYPE_STR, ITEM(res_client.log_timestamp_format), 0, 0, NULL, "15.2.3-", NULL },
{ NULL, 0, { 0 }, 0, 0, NULL, NULL, NULL }
};

Expand Down Expand Up @@ -365,8 +365,8 @@ void free_resource(RES *sres, int type)
if (res->res_client.secure_erase_cmdline) {
free(res->res_client.secure_erase_cmdline);
}
if (res->res_client.log_date_format) {
free(res->res_client.log_date_format);
if (res->res_client.log_timestamp_format) {
free(res->res_client.log_timestamp_format);
}
break;
case R_MSGS:
Expand Down
2 changes: 1 addition & 1 deletion src/filed/filed_conf.h
Expand Up @@ -117,7 +117,7 @@ class CLIENTRES : public BRSRES {
TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
char *verid; /* Custom Id to print in version command */
char *secure_erase_cmdline; /* Cmdline to execute to perform secure erase of file */
char *log_date_format; /* Date format to use in generic logging messages */
char *log_timestamp_format; /* Timestamp format to use in generic logging messages */
uint64_t max_bandwidth_per_job; /* Bandwidth limitation (global) */
};

Expand Down
14 changes: 5 additions & 9 deletions src/lib/message.c
Expand Up @@ -76,7 +76,7 @@ void setup_tsd_key();
static pthread_mutex_t fides_mutex = PTHREAD_MUTEX_INITIALIZER;
static MSGSRES *daemon_msgs; /* Global messages */
static char *catalog_db = NULL; /* Database type */
static const char *log_date_format = "%d-%b %H:%M";
static const char *log_timestamp_format = "%d-%b %H:%M";
static void (*message_callback)(int type, char *msg) = NULL;
static FILE *trace_fd = NULL;
#if defined(HAVE_WIN32)
Expand Down Expand Up @@ -145,13 +145,11 @@ static void delivery_error(const char *fmt,...)
int i, len, maxlen;
POOLMEM *pool_buf;
char dt[MAX_TIME_LENGTH];
int dtlen;

pool_buf = get_pool_memory(PM_EMSG);

bstrftime(dt, sizeof(dt), time(NULL), log_date_format);
bstrftime(dt, sizeof(dt), time(NULL), log_timestamp_format);
bstrncat(dt, " ", sizeof(dt));
dtlen = strlen(dt);

i = Mmsg(pool_buf, "%s Message delivery ERROR: ", dt);

Expand Down Expand Up @@ -844,7 +842,6 @@ void dispatch_message(JCR *jcr, int type, utime_t mtime, char *msg)
MSGSRES *msgs;
BPIPE *bpipe;
const char *mode;
bool dt_set = false;

Dmsg2(850, "Enter dispatch_message type=%d msg=%s", type, msg);

Expand All @@ -863,10 +860,9 @@ void dispatch_message(JCR *jcr, int type, utime_t mtime, char *msg)
dtlen = 0;
mtime = time(NULL); /* get time for SQL log */
} else {
bstrftime(dt, sizeof(dt), mtime, log_date_format);
bstrftime(dt, sizeof(dt), mtime, log_timestamp_format);
bstrncat(dt, " ", sizeof(dt));
dtlen = strlen(dt);
dt_set = true;
}

/*
Expand Down Expand Up @@ -1924,7 +1920,7 @@ void q_msg(const char *file, int line, JCR *jcr, int type, utime_t mtime, const
/*
* Set gobal date format used for log messages.
*/
void set_log_date_format(const char *format)
void set_log_timestamp_format(const char *format)
{
log_date_format = format;
log_timestamp_format = format;
}
2 changes: 1 addition & 1 deletion src/lib/message.h
Expand Up @@ -165,7 +165,7 @@ void Jmsg(JCR *jcr, int type, utime_t mtime, const char *fmt,...);
void Qmsg(JCR *jcr, int type, utime_t mtime, const char *fmt,...);
bool get_trace(void);
const char *get_basename(const char *pathname);
void set_log_date_format(const char *format);
void set_log_timestamp_format(const char *format);

typedef bool (*db_log_insert_func)(JCR *jcr, utime_t mtime, char *msg);
extern DLL_IMP_EXP db_log_insert_func p_db_log_insert;
Expand Down
4 changes: 2 additions & 2 deletions src/stored/stored.c
Expand Up @@ -520,8 +520,8 @@ static int check_resources()
if (me->secure_erase_cmdline) {
set_secure_erase_cmdline(me->secure_erase_cmdline);
}
if (me->log_date_format) {
set_log_date_format(me->log_date_format);
if (me->log_timestamp_format) {
set_log_timestamp_format(me->log_timestamp_format);
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/stored/stored_conf.c
Expand Up @@ -109,7 +109,7 @@ static RES_ITEM store_items[] = {
{ "DeviceReserveByMediaType", CFG_TYPE_BOOL, ITEM(res_store.device_reserve_by_mediatype), 0, CFG_ITEM_DEFAULT, "false", NULL, NULL },
{ "FileDeviceConcurrentRead", CFG_TYPE_BOOL, ITEM(res_store.filedevice_concurrent_read), 0, CFG_ITEM_DEFAULT, "false", NULL, NULL },
{ "SecureEraseCommand", CFG_TYPE_STR, ITEM(res_store.secure_erase_cmdline), 0, 0, NULL, NULL, NULL },
{ "LogDateFormat", CFG_TYPE_STR, ITEM(res_store.log_date_format), 0, 0, NULL, NULL, NULL },
{ "LogTimestampFormat", CFG_TYPE_STR, ITEM(res_store.log_timestamp_format), 0, 0, NULL, "15.2.3-", NULL },
{ NULL, 0, { 0 }, 0, 0, NULL, NULL, NULL }
};

Expand Down Expand Up @@ -636,8 +636,8 @@ void free_resource(RES *sres, int type)
if (res->res_store.secure_erase_cmdline) {
free(res->res_store.secure_erase_cmdline);
}
if (res->res_store.log_date_format) {
free(res->res_store.log_date_format);
if (res->res_store.log_timestamp_format) {
free(res->res_store.log_timestamp_format);
}
break;
case R_DEVICE:
Expand Down
2 changes: 1 addition & 1 deletion src/stored/stored_conf.h
Expand Up @@ -124,7 +124,7 @@ class STORES : public BRSRES {
alist *tls_allowed_cns; /* TLS Allowed Clients */
char *verid; /* Custom Id to print in version command */
char *secure_erase_cmdline; /* Cmdline to execute to perform secure erase of file */
char *log_date_format; /* Date format to use in generic logging messages */
char *log_timestamp_format; /* Timestamp format to use in generic logging messages */
uint64_t max_bandwidth_per_job; /* Bandwidth limitation (global) */

TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
Expand Down

0 comments on commit 7ac3596

Please sign in to comment.