Features:
- 日志服务模块化,每个模块可以共享使用
- 日志模块与输出模块相互独立,可以是N:N的关系(比如,一个日志模块可以输出到独立的文件中)
- 文件输出模式可以按照轮转、周期、文件大小来控制输出日志的数量
- 日志模块之间可以是继承关系,采用.来确定关系,一些模块属性也会从父模块中继承到子模块中
- 日志记录输出类型有多种,详见root.__type__, 各类型之间是"或"的关系,并能随着继承关系传递,到子模块
- 配置文件可以实时修改,即时生效,无需重启应用程序
- 支持终端彩色输出
- 可根据函数调用栈分级输出日志,方便查看函数的调用次序

配置文件模板
[global] # Global configure. # Logger accesses this config-file per <check_config_interval>, # that will reload this config-file that be modified and validate # the new strategy. # The 'interval' is by Second Unit if the last charactor is 's/S', # on 'm/M' by minute, others are not supported(default is 's'). check_config_interval = 5s [screen_output] # ouput configure. # Support : STDOUT,FILES,SHUTDOWN type = shutdown [file_output] # ouput configure. # Support : STDOUT,FILES,SHUTDOWN type = FILES # Log file name name = http dir = ./log # Single file size. # The 'size' is by MBytes Unit if the last charactor is 'M', # on 'K' by KBytes, others do not supported(default is 'M'). # If value is ''(null), the file size is unlimited. # Default value is 1M single_file_size = 2M # Max index of rolloever. # For example : <rolloever> = 5 # 2008-08-08.log(current), 2008-08-08.log.1, 2008-08-08.log.2, # 2008-08-08.log.3, 2008-08-08.log.4, 2008-08-08.log.5(lasted). # Default value is 0 rolloever = 5 # Support : Seconds. # How long create a new log file. # If value is ''(null), this abbtribute will be disable. # Default value is 0 generate_file_period = [modules] ## # Support : ALLS|TRACE|DEBUG|WNING|ERROR|RINFO|FATAL|SHUTDOWN # Log type is hereditable, all of modules inherit from <root> # If value is ''(null), the root has not strategy. # Don't delete this attribute !!!. root.__type__ = ERROR|RINFO # Example : # http_server = TRACE|RINFO # actually is root.http_server # http_server.request = DEBUG # ftp_server.download = RINFO|FATAL # If you want to close the logger of this module, you must type `SHUTDOWN' # and not ''. # ftp_server.upload = SHUTDOWN # If value is ''(null), the module's configure inherits from its parent # Mode of log-msg be output # If value is ''(null), the output default set to `NULL' root.__output__ = file_output # Max length of one log record(not include format string!!), Bytes Unit # Default value is 511 root.__max_len_of_one_record__ = 1023 ## end # user's log modules # example: root.main.__type__ = DEBUG|TRACE root.main.__output__ = root.main.test.__type__ = TRACE root.main.test.sub.__type__ = WNING root.main.test.sub.__output__ = screen_output,~file_output root.main.test.sub.sub_1.__type__ = WNING root.main.test.sub.sub_2.__type__ = WNING root.main.test.sub.sub_3.__type__ = WNING root.main.test.sub.sub_4.__type__ = WNING如遇问题请发到 shaovie@gmail.com
 
                    
                     
                    
                 
                    
                 
 
         
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号