< Summary - Backend C Tests - Coverage Report (WSL)

Information
Class: logger_c
Assembly: src.backend.core.utils
File(s): ./src/backend/core/utils/logger.c
Line coverage
100%
Covered lines: 46
Uncovered lines: 0
Coverable lines: 46
Total lines: 70
Line coverage: 100%
Branch coverage
87%
Covered branches: 7
Total branches: 8
Branch coverage: 87.5%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 2/18/2026 - 10:50:55 PM Line coverage: 100% (46/46) Branch coverage: 87.5% (7/8) Total lines: 70 2/18/2026 - 10:50:55 PM Line coverage: 100% (46/46) Branch coverage: 87.5% (7/8) Total lines: 70

File(s)

./src/backend/core/utils/logger.c

#LineLine coverage
 1/* This file is a template for logger.c. Content will be filled by yagiz on 2025-12-29. */
 2#include "logger.h"
 3#include <stdio.h>
 4#include <stdarg.h>
 5#include <time.h>
 6
 7static LogLevel current_log_level = LOG_LEVEL_INFO;
 8
 9// Zaman damgası al
 510static void print_timestamp(FILE *out) {
 511  time_t now = time(NULL);
 512  struct tm *t = localtime(&now);
 513  fprintf(out, "[%02d:%02d:%02d] ", t->tm_hour, t->tm_min, t->tm_sec);
 514}
 15
 316void logger_set_level(LogLevel level) {
 317  current_log_level = level;
 318}
 19
 320LogLevel logger_get_level(void) {
 321  return current_log_level;
 22}
 23
 324void log_error(const char *format, ...) {
 325  if (current_log_level >= LOG_LEVEL_ERROR) {
 26    va_list args;
 227    print_timestamp(stderr);
 228    fprintf(stderr, "[ERROR] ");
 229    va_start(args, format);
 230    vfprintf(stderr, format, args);
 231    va_end(args);
 232    fprintf(stderr, "\n");
 33  }
 334}
 35
 236void log_warn(const char *format, ...) {
 237  if (current_log_level >= LOG_LEVEL_WARN) {
 38    va_list args;
 139    print_timestamp(stderr);
 140    fprintf(stderr, "[WARN] ");
 141    va_start(args, format);
 142    vfprintf(stderr, format, args);
 143    va_end(args);
 144    fprintf(stderr, "\n");
 45  }
 246}
 47
 248void log_info(const char *format, ...) {
 249  if (current_log_level >= LOG_LEVEL_INFO) {
 50    va_list args;
 151    print_timestamp(stdout);
 152    fprintf(stdout, "[INFO] ");
 153    va_start(args, format);
 154    vfprintf(stdout, format, args);
 155    va_end(args);
 156    fprintf(stdout, "\n");
 57  }
 258}
 59
 160void log_debug(const char *format, ...) {
 161  if (current_log_level >= LOG_LEVEL_DEBUG) {
 62    va_list args;
 163    print_timestamp(stdout);
 164    fprintf(stdout, "[DEBUG] ");
 165    va_start(args, format);
 166    vfprintf(stdout, format, args);
 167    va_end(args);
 168    fprintf(stdout, "\n");
 69  }
 170}

Methods/Properties