My Project
Public Member Functions | Static Public Member Functions | List of all members
ParaEngine::CLogService Class Reference

Log rules. More...

#include <LogService.h>

Public Member Functions

CServiceLogger_ptr GetLogger (const std::string &name)
 Retrieve a logger by name. More...
 
CServiceLogger_ptr GetLogger (const char *const name)
 Retrieve a logger by name. More...
 

Static Public Member Functions

static CLogServiceGetSingleton ()
 get an instance of this class
 

Detailed Description

Log rules.

There are 2 types of log: a. runtime log: Programming info. debug info will be written here. b. service log: Formatted date info. for stat, monitor and other things.

I£®open mode To open a log file,we need use ¡°a+¡± mode: fopen(const char * filename, ¡°a+¡±) Open for reading and writing. The file is created if it does not exist. So we need not to worry about log missing.

II. log name File name rule a. runtime log,use program name for first part of log name,like£º para_engine_server.log b. service log. Use service name + _date + .log,like: UserLogin_20090709.log

III fields content Every log need a time formate on the first field of line. 2009-07-09 16:40:05

Separator : |

Content: a. runtime log: cat para_engine_server.log 2009-07-09 16:40:05|the id value=5 2009-07-09 16:40:05|app "EditApps" loaded 2009-07-09 16:40:05|counter=10000

b. service log,log format like: cat user_click_20090709.log 2009-07-09 09:34:23|13307||||70|2|1|61.144.207.30 2009-07-09 09:42:52|13307||||74|2|1|61.144.207.30 2009-07-09 09:45:31|13307||||44|2|1|61.144.207.30 2009-07-09 09:45:31|13307||||44|2|1|61.144.207.30

IV. others If we need write same service log from several threads or processes . we do not lock the file. Just writing. The analyse process will deal with it if the data is confused.

Member Function Documentation

§ GetLogger() [1/2]

ParaEngine::CServiceLogger_ptr ParaEngine::CLogService::GetLogger ( const std::string &  name)

Retrieve a logger by name.

It will create one if not exist

Parameters
namelogger name.

§ GetLogger() [2/2]

ParaEngine::CServiceLogger_ptr ParaEngine::CLogService::GetLogger ( const char *const  name)

Retrieve a logger by name.

It will create one if not exist

Parameters
namelogger name.

The documentation for this class was generated from the following files: