/[LeafOK_CVS]/lbbs/src/log.c
ViewVC logotype

Diff of /lbbs/src/log.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.35 by sysadm, Mon Nov 17 11:22:16 2025 UTC Revision 1.36 by sysadm, Thu Dec 18 02:54:16 2025 UTC
# Line 79  inline static void log_head(char *buf, s Line 79  inline static void log_head(char *buf, s
79          {          {
80                  snprintf(buf, len, "[%s] [%d] [INFO] ", s_time, getpid());                  snprintf(buf, len, "[%s] [%d] [INFO] ", s_time, getpid());
81          }          }
82          else // if (log_level == LOG_LEVEL_ERROR)          else if (log_level == LOG_LEVEL_ERROR)
83          {          {
84                  snprintf(buf, len, "[%s] [%d] [ERROR] [%s:%d] ", s_time, getpid(), app_file, app_line);                  snprintf(buf, len, "[%s] [%d] [ERROR] [%s:%d] ", s_time, getpid(), app_file, app_line);
85          }          }
86            else // if (log_level == LOG_LEVEL_DEBUG)
87            {
88                    snprintf(buf, len, "[%s] [%d] [DEBUG] [%s:%d] ", s_time, getpid(), app_file, app_line);
89            }
90  }  }
91    
92  int log_printf(enum log_level_t log_level, const char *app_file, int app_line, const char *format, ...)  int log_printf(enum log_level_t log_level, const char *app_file, int app_line, const char *format, ...)
# Line 92  int log_printf(enum log_level_t log_leve Line 96  int log_printf(enum log_level_t log_leve
96          char buf[LINE_BUFFER_LEN];          char buf[LINE_BUFFER_LEN];
97          FILE *fp_log;          FILE *fp_log;
98    
99          fp_log = (log_level == LOG_LEVEL_ERROR ? fp_error_log : fp_common_log);          fp_log = (log_level == LOG_LEVEL_COMMON ? fp_common_log : fp_error_log);
100    
101          log_head(buf, sizeof(buf), log_level, app_file, app_line);          log_head(buf, sizeof(buf), log_level, app_file, app_line);
102          strncat(buf, format, sizeof(buf) - strnlen(buf, sizeof(buf)));          strncat(buf, format, sizeof(buf) - strnlen(buf, sizeof(buf)));


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1