32#include <trace-util.h>
56 const char *last = path;
60 if (*p ==
'/' || *p ==
'\\')
76 enum trace_level trc_level;
83 trc_level = (
enum trace_level)(
int)level;
93 trace_modify_name(
s_trace,
"porter", 0);
102 trace_modify_ostrc(
s_trace, trc_level);
107 if (trace_modify_filetrc(
s_trace,
108 (log_file != NULL && log_file[0] !=
'\0') ? log_file : NULL,
109 trc_level, 0, 0) != 0)
116 trace_modify_stderrtrc(
s_trace, console ? trc_level : TRACE_LV_NONE);
129 const char *fmt, ...)
133 enum trace_level min_lv;
145 min_lv = trace_get_ostrc(
s_trace);
146 lv = trace_get_filetrc(
s_trace);
147 if ((
int)lv < (
int)min_lv) { min_lv = lv; }
148 lv = trace_get_stderrtrc(
s_trace);
149 if ((
int)lv < (
int)min_lv) { min_lv = lv; }
150 if ((
int)level > (
int)min_lv || (
int)min_lv >= (
int)TRACE_LV_NONE)
157 (void)vsnprintf(msg,
sizeof(msg), fmt, ap);
164 (void)trace_writef(
s_trace, (
enum trace_level)(
int)level,
#define POTR_SUCCESS
成功の戻り値を表す定数。
#define POTR_ERROR
失敗の戻り値を表す定数。
通信ライブラリ (動的リンク用) のヘッダーファイル。
#define POTR_API
呼び出し規約マクロ。
#define POTR_EXPORT
DLL エクスポート/インポート制御マクロ。
@ POTR_TRACE_NONE
ログ出力無効。TRACE_LV_NONE (5) と同値。
POTR_EXPORT int POTR_API potrLogConfig(PotrLogLevel level, const char *log_file, int console)
ロガーを設定します。
void potr_log_write(PotrLogLevel level, const char *file, int line, const char *fmt,...)
ログメッセージを書き込みます (内部関数)。
static trace_provider_t * s_trace
トレースプロバイダハンドル。trace_init() で一度だけ初期化する。
static const char * log_basename(const char *path)
パスの末尾ファイル名部分を返す。