diff options
| author | Egor Tensin <egor@tensin.name> | 2026-06-13 19:51:00 +0200 |
|---|---|---|
| committer | Egor Tensin <egor@tensin.name> | 2026-06-13 19:51:04 +0200 |
| commit | 84262d9f69aa6730c69f464b5b4fb7f6030bf329 (patch) | |
| tree | 44a506c7c10923e32ab2063594ec4049b988e97a /src/log.c | |
| parent | add .git-blame-ignore-revs (diff) | |
| download | cimple-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.c | 42 |
1 files changed, 21 insertions, 21 deletions
@@ -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); } |
