aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/log.c
diff options
context:
space:
mode:
authorEgor Tensin <egor@tensin.name>2026-06-13 19:51:00 +0200
committerEgor Tensin <egor@tensin.name>2026-06-13 19:51:04 +0200
commit84262d9f69aa6730c69f464b5b4fb7f6030bf329 (patch)
tree44a506c7c10923e32ab2063594ec4049b988e97a /src/log.c
parentadd .git-blame-ignore-revs (diff)
downloadcimple-84262d9f69aa6730c69f464b5b4fb7f6030bf329.tar.gz
cimple-84262d9f69aa6730c69f464b5b4fb7f6030bf329.zip
switch from tabs to spaces
It was fun while it lasted, but I do believe that spaces are strictly superior, and clang-format struggles with tabs while using advanced configuration options.
Diffstat (limited to 'src/log.c')
-rw-r--r--src/log.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/log.c b/src/log.c
index 1761523..8a1adcc 100644
--- a/src/log.c
+++ b/src/log.c
@@ -15,36 +15,36 @@
int g_log_lvl = LOG_LVL_INFO;
static inline void log_prefix_timestamp(FILE* dest) {
- struct timeval tv;
- struct tm tm;
- char buf[64];
- size_t used = 0;
+ struct timeval tv;
+ struct tm tm;
+ char buf[64];
+ size_t used = 0;
- if (gettimeofday(&tv, NULL) < 0)
- return;
- if (!gmtime_r(&tv.tv_sec, &tm))
- return;
+ if (gettimeofday(&tv, NULL) < 0)
+ return;
+ if (!gmtime_r(&tv.tv_sec, &tm))
+ return;
- buf[0] = '\0';
- used += strftime(buf + used, sizeof(buf) - used, "%F %T", &tm);
- long long msec = (long long)tv.tv_usec / 1000;
- used += snprintf(buf + used, sizeof(buf) - used, ".%03lld | ", msec);
- fprintf(dest, "%s", buf);
+ buf[0] = '\0';
+ used += strftime(buf + used, sizeof(buf) - used, "%F %T", &tm);
+ long long msec = (long long)tv.tv_usec / 1000;
+ used += snprintf(buf + used, sizeof(buf) - used, ".%03lld | ", msec);
+ fprintf(dest, "%s", buf);
}
static inline void log_prefix_thread_id(FILE* dest) {
- fprintf(dest, "%d | ", gettid());
+ fprintf(dest, "%d | ", gettid());
}
int log_entry_start(int lvl, FILE* dest) {
- if (lvl < g_log_lvl)
- return 0;
- flockfile(dest);
- log_prefix_timestamp(dest);
- log_prefix_thread_id(dest);
- return 1;
+ if (lvl < g_log_lvl)
+ return 0;
+ flockfile(dest);
+ log_prefix_timestamp(dest);
+ log_prefix_thread_id(dest);
+ return 1;
}
void log_entry_end(FILE* dest) {
- funlockfile(dest);
+ funlockfile(dest);
}