aboutsummaryrefslogtreecommitdiff
path: root/src/log.c
blob: 8809c846b7326dd11d67d0051f17f2f22feb7aa2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <stdio.h>
#include <time.h>

#include "log.h"

log_priority log_prio = NOTICE;
log_open_cb log_open = NULL;
log_close_cb log_close = NULL;
log_fmt_cb log_fmt = NULL;
log_fmtex_cb log_fmtex = NULL;
log_fmtexerr_cb log_fmtexerr = NULL;


char *
curtime_str(char *buf, size_t siz)
{
    time_t t;
    struct tm *tmp;

    t = time(NULL);
    tmp = localtime(&t);

    if (!strftime(buf, siz, "%d %b %y - %H:%M:%S", tmp))
        snprintf(buf, siz, "%s", "UNKNOWN_TIME");

    return buf;
}