|
Document of c-modernization-kit (porter) 1.0.0
|
porter ロガー実装。 More...
#include <stdarg.h>#include <stdio.h>#include <string.h>#include <trace-util.h>#include <porter_const.h>#include <porter.h>#include "potrLog.h"Go to the source code of this file.
Functions | |
| static const char * | log_basename (const char *path) |
| パスの末尾ファイル名部分を返す。 | |
| 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,...) |
| ログメッセージを書き込みます (内部関数)。 | |
Variables | |
| static trace_provider_t * | s_trace = NULL |
| トレースプロバイダハンドル。trace_init() で一度だけ初期化する。 | |
porter ロガー実装。
trace-util のプロキシモジュールです。
OS レベルのトレース出力 (Linux: syslog、Windows: ETW)、 ファイルトレース、stderr 出力のすべてを trace-util に委任します。
| OS | 出力先 |
|---|---|
| Linux | syslog (trace-util 経由)、ログファイル (trace-util 経由)、stderr (trace-util 経由、console 指定時) |
| Windows | ETW (trace-util 経由)、ログファイル (trace-util 経由)、stderr (trace-util 経由、console 指定時) |
Definition in file potrLog.c.
|
static |
パスの末尾ファイル名部分を返す。
'/' または '\' の最後の出現以降の文字列を返します。
区切り文字が存在しない場合は path をそのまま返します。
Definition at line 53 of file potrLog.c.
Referenced by potr_log_write().
| POTR_EXPORT int POTR_API potrLogConfig | ( | PotrLogLevel | level, |
| const char * | log_file, | ||
| int | console ) |
ロガーを設定します。
| [in] | level | 出力する最低ログレベル。POTR_TRACE_NONE でログ無効 (デフォルト)。 |
| [in] | log_file | ログファイルのパス。NULL または空文字列を指定するとファイル出力なし。 |
| [in] | console | 0 以外を指定すると標準エラー出力 (stderr) にも出力します。 |
本関数は potrOpenService() の前に呼び出してください。
複数回呼び出した場合は最後の設定が有効になります。
| OS | 出力先 |
|---|---|
| Linux | syslog (trace-util 経由)、ログファイル (trace-util 経由、log_file 指定時)、stderr (trace-util 経由、console 指定時) |
| Windows | ETW (trace-util 経由)、ログファイル (trace-util 経由、log_file 指定時)、stderr (trace-util 経由、console 指定時) |
| レベル | 値 | 出力内容 |
|---|---|---|
| POTR_TRACE_CRITICAL | 0 | 致命的エラー |
| POTR_TRACE_ERROR | 1 | 操作失敗 |
| POTR_TRACE_WARNING | 2 | NACK・REJECT・回復可能な異常 |
| POTR_TRACE_INFO | 3 | サービス開始・終了・接続状態変化 |
| POTR_TRACE_VERBOSE | 4 | ソケット操作・設定値・パケット送受信・スレッド動作 |
| POTR_TRACE_NONE | 5 | ログ無効 (デフォルト) |
Definition at line 72 of file potrLog.c.
References POTR_API, POTR_ERROR, POTR_EXPORT, POTR_SUCCESS, POTR_TRACE_NONE, and s_trace.
Referenced by main().
| void potr_log_write | ( | PotrLogLevel | level, |
| const char * | file, | ||
| int | line, | ||
| const char * | fmt, | ||
| ... ) |
ログメッセージを書き込みます (内部関数)。
| [in] | level | ログレベル。 |
| [in] | file | ソースファイル名 (FILE)。 |
| [in] | line | 行番号 (LINE)。 |
| [in] | fmt | printf 形式のフォーマット文字列。 |
| [in] | ... | フォーマット引数。 |
g_log_level より低いレベルのメッセージは無視されます (高速パス)。
本関数を直接呼び出さず、POTR_LOG マクロを使用してください。
Definition at line 128 of file potrLog.c.
References log_basename(), and s_trace.
|
static |
トレースプロバイダハンドル。trace_init() で一度だけ初期化する。
Definition at line 42 of file potrLog.c.
Referenced by potr_log_write(), and potrLogConfig().