7 #ifndef __MUN_LOGGER_HPP__ 8 #define __MUN_LOGGER_HPP__ 16 #ifndef MRSEXT_LOG_BUF_SIZE 17 #define MRSEXT_LOG_BUF_SIZE MRS_LOG_BUF_SIZE+512 27 #define MRSEXT_OUTPUT_LOG( _level, _format, ... ) \ 29 char _msg[MRSEXT_LOG_BUF_SIZE]; \ 30 std::string _extFormat = std::string("%s\t%s(%d)\t") + std::string(_format); \ 31 snprintf( _msg, sizeof(_msg), _extFormat.c_str(), __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__ ); \ 32 mrs_output_log( _level, _msg ); \ 41 #define MRSEXT_LOG_EMERG( _format, ... ) MRSEXT_OUTPUT_LOG( MRS_LOG_LEVEL_EMERG, _format, ##__VA_ARGS__ ) 49 #define MRSEXT_LOG_ALERT( _format, ... ) MRSEXT_OUTPUT_LOG( MRS_LOG_LEVEL_ALERT, _format, ##__VA_ARGS__ ) 57 #define MRSEXT_LOG_CRIT( _format, ... ) MRSEXT_OUTPUT_LOG( MRS_LOG_LEVEL_CRIT, _format, ##__VA_ARGS__ ) 65 #define MRSEXT_LOG_ERR( _format, ... ) MRSEXT_OUTPUT_LOG( MRS_LOG_LEVEL_ERR, _format, ##__VA_ARGS__ ) 73 #define MRSEXT_LOG_WARNING( _format, ... ) MRSEXT_OUTPUT_LOG( MRS_LOG_LEVEL_WARNING, _format, ##__VA_ARGS__ ) 81 #define MRSEXT_LOG_NOTICE( _format, ... ) MRSEXT_OUTPUT_LOG( MRS_LOG_LEVEL_NOTICE, _format, ##__VA_ARGS__ ) 89 #define MRSEXT_LOG_INFO( _format, ... ) MRSEXT_OUTPUT_LOG( MRS_LOG_LEVEL_INFO, _format, ##__VA_ARGS__ ) 97 #define MRSEXT_LOG_DEBUG( _format, ... ) MRSEXT_OUTPUT_LOG( MRS_LOG_LEVEL_DEBUG, _format, ##__VA_ARGS__ ) 107 MUN_LOG_ROTATE_NONE = 0,
108 MUN_LOG_ROTATE_DAILY = 1,
141 static void Initialize( std::string processName,
bool isOutputLogFile, std::string outputLogFileName );
153 static void OnOutput( MrsLogLevel level,
const char * msg );
166 static bool Rotate(
const char* src_file_name,
const char* dst_file_name );
175 static void OutputFile( std::string ts, MrsLogLevel level,
const char * msg );
183 static void OutputConsole( std::string ts, MrsLogLevel level,
const char * msg );
static void Finalize()
終了処理.
Definition: MunLogger.cpp:107
static std::string s_LogFileName
ログファイル名.
Definition: MunLogger.hpp:119
static struct tm s_Updated
最終更新日時.
Definition: MunLogger.hpp:125
static void SetLogRotate(MunLogRotate value)
ログローテートの設定.
Definition: MunLogger.hpp:132
static MunLogRotate s_LogRotate
ログローテート.
Definition: MunLogger.hpp:122
static FILE * s_pLogFile
ログファイル本体.
Definition: MunLogger.hpp:116
static bool Rotate(const char *src_file_name, const char *dst_file_name)
ローテート.
Definition: MunLogger.cpp:157
ログ管理クラス.
Definition: MunLogger.hpp:102
static void Initialize(std::string processName, bool isOutputLogFile, std::string outputLogFileName)
初期化処理.
Definition: MunLogger.cpp:80
static void Reload()
ログファイルの再読み込み.
Definition: MunLogger.cpp:144
static std::string s_ProcessName
プロセス名.
Definition: MunLogger.hpp:113
static void OnOutput(MrsLogLevel level, const char *msg)
ログの出力.
Definition: MunLogger.cpp:122