mirror of
https://github.com/simon987/sist2.git
synced 2025-12-20 02:26:08 +00:00
use sqlite to save index, major thread pool refactor
This commit is contained in:
43
src/log.h
43
src/log.h
@@ -2,6 +2,7 @@
|
||||
#define SIST2_LOG_H
|
||||
|
||||
|
||||
#include <signal.h>
|
||||
#define LOG_MAX_LENGTH 8192
|
||||
|
||||
#define LOG_SIST_DEBUG 0
|
||||
@@ -10,37 +11,37 @@
|
||||
#define LOG_SIST_ERROR 3
|
||||
#define LOG_SIST_FATAL 4
|
||||
|
||||
#define LOG_DEBUGF(filepath, fmt, ...) \
|
||||
if (LogCtx.very_verbose) {sist_logf(filepath, LOG_SIST_DEBUG, fmt, __VA_ARGS__);}
|
||||
#define LOG_DEBUG(filepath, str) \
|
||||
if (LogCtx.very_verbose) {sist_log(filepath, LOG_SIST_DEBUG, str);}
|
||||
#define LOG_DEBUGF(filepath, fmt, ...) do{\
|
||||
if (LogCtx.very_verbose) {sist_logf(filepath, LOG_SIST_DEBUG, fmt, __VA_ARGS__);}}while(0)
|
||||
#define LOG_DEBUG(filepath, str) do{\
|
||||
if (LogCtx.very_verbose) {sist_log(filepath, LOG_SIST_DEBUG, str);}}while(0)
|
||||
|
||||
#define LOG_INFOF(filepath, fmt, ...) \
|
||||
if (LogCtx.verbose) {sist_logf(filepath, LOG_SIST_INFO, fmt, __VA_ARGS__);}
|
||||
#define LOG_INFO(filepath, str) \
|
||||
if (LogCtx.verbose) {sist_log(filepath, LOG_SIST_INFO, str);}
|
||||
#define LOG_INFOF(filepath, fmt, ...) do {\
|
||||
if (LogCtx.verbose) {sist_logf(filepath, LOG_SIST_INFO, fmt, __VA_ARGS__);}} while(0)
|
||||
#define LOG_INFO(filepath, str) do {\
|
||||
if (LogCtx.verbose) {sist_log(filepath, LOG_SIST_INFO, str);}} while(0)
|
||||
|
||||
#define LOG_WARNINGF(filepath, fmt, ...) \
|
||||
if (LogCtx.verbose) {sist_logf(filepath, LOG_SIST_WARNING, fmt, __VA_ARGS__);}
|
||||
#define LOG_WARNING(filepath, str) \
|
||||
if (LogCtx.verbose) {sist_log(filepath, LOG_SIST_WARNING, str);}
|
||||
#define LOG_WARNINGF(filepath, fmt, ...) do {\
|
||||
if (LogCtx.verbose) {sist_logf(filepath, LOG_SIST_WARNING, fmt, __VA_ARGS__);}}while(0)
|
||||
#define LOG_WARNING(filepath, str) do{\
|
||||
if (LogCtx.verbose) {sist_log(filepath, LOG_SIST_WARNING, str);}}while(0)
|
||||
|
||||
#define LOG_ERRORF(filepath, fmt, ...) \
|
||||
if (LogCtx.verbose) {sist_logf(filepath, LOG_SIST_ERROR, fmt, __VA_ARGS__);}
|
||||
#define LOG_ERROR(filepath, str) \
|
||||
if (LogCtx.verbose) {sist_log(filepath, LOG_SIST_ERROR, str);}
|
||||
#define LOG_ERRORF(filepath, fmt, ...) do {\
|
||||
if (LogCtx.verbose) {sist_logf(filepath, LOG_SIST_ERROR, fmt, __VA_ARGS__);}}while(0)
|
||||
#define LOG_ERROR(filepath, str) do{\
|
||||
if (LogCtx.verbose) {sist_log(filepath, LOG_SIST_ERROR, str);}}while(0)
|
||||
|
||||
#define LOG_FATALF(filepath, fmt, ...) \
|
||||
#define LOG_FATALF(filepath, fmt, ...)\
|
||||
sist_logf(filepath, LOG_SIST_FATAL, fmt, __VA_ARGS__);\
|
||||
exit(-1);
|
||||
raise(SIGUSR1)
|
||||
#define LOG_FATAL(filepath, str) \
|
||||
sist_log(filepath, LOG_SIST_FATAL, str);\
|
||||
exit(-1);
|
||||
exit(SIGUSR1)
|
||||
|
||||
#define LOG_FATALF_NO_EXIT(filepath, fmt, ...) \
|
||||
sist_logf(filepath, LOG_SIST_FATAL, fmt, __VA_ARGS__);
|
||||
sist_logf(filepath, LOG_SIST_FATAL, fmt, __VA_ARGS__)
|
||||
#define LOG_FATAL_NO_EXIT(filepath, str) \
|
||||
sist_log(filepath, LOG_SIST_FATAL, str);
|
||||
sist_log(filepath, LOG_SIST_FATAL, str)
|
||||
|
||||
#include "sist.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user