Documentation ¶
Index ¶
- Constants
- func SLog(sld int, log_level int, format string, arg ...interface{}) int
- func SLogBytes(sld int, log_level int, bs []byte) int
- func SLogChgAttr(sld int, filt_level int, degree int, size int, rotate int, format int) int
- func SLogClose(sld int) int
- func SLogLocalOpen(filt_level int, log_name string, format int, log_degree int, log_size int, ...) int
- func SLogNetOpen(filt_level int, ip string, port int, format int, log_degree int) int
- func SLogString(sld int, log_level int, str string) int
- type LogHeader
- type NetLog
- type SLogPen
- func (lp *SLogPen) ChgAttr(attr int, value int) int
- func (lp *SLogPen) Close()
- func (lp *SLogPen) Debug(format string, arg ...interface{})
- func (lp *SLogPen) Err(format string, arg ...interface{})
- func (lp *SLogPen) Fatal(format string, arg ...interface{})
- func (lp *SLogPen) Info(format string, arg ...interface{})
- func (lp *SLogPen) Log(log_level int, format string, arg ...interface{})
- type SNetLogPen
Constants ¶
const ( //Attr LOG_ATTR_LEVEL = 1 //chg log filt level. refer LOG_LV_XX LOG_ATTR_DEGREEE = 2 //chg log time degree. refer LOG_DEGREE_XX LOG_ATTR_ROTATE = 3 //chg log rotate number LOG_ATTR_SIZE = 4 //chg log size must>1024 //LOG-DEGREE LOG_DEGREE_SEC = 1 //sec LOG_DEGREE_MIL = 2 //milli sec LOG_DEGREE_MIC = 3 //micro sec LOG_DEGREE_NANO = 4 //nano sec //TIME-FORMAT TIME_FORMAT_SEC = "2006-01-02 15:04:05" TIME_FORMAT_MILL = "2006-01-02 15:04:05.000" TIME_FORMAT_MICR = "2006-01-02 15:04:05.000000" TIME_FORMAT_NANO = "2006-01-02 15:04:05.000000000" //LOG-LEVEL LOG_LV_DEBUG = SL_DEBUG //debug LOG_LV_INFO = SL_INFO //info LOG_LV_ERR = SL_ERR //err LOG_LV_FATAL = SL_FATAL //fatal LOG_CH_SIZE = 4098 //channel of log //NET-LOG-METHOD //if peer count > 1 NETLOG_METHOD_SEQ = 1 //report log to peer which is latest valid NETLOG_METHOD_ALL = 2 //report log to all peer NETLOG_METHOD_MOD = 3 //report log to proc_id%peer_count to peer NETLOG_METHOD_RAND = 4 //report log to a rand peer //DEFAULT LOG_DEFAULT_FILT_LEVEL = LOG_LV_DEBUG LOG_DEFAULT_DEGREE = LOG_DEGREE_MIL LOG_DEFAULT_ROTATE = 5 //default rotate 5 LOG_DEFAULT_SIZE = (50 * 1024 * 1024) //default size:50M NETLOG_DEFAULT_METHOD = NETLOG_METHOD_RAND NETLOG_DEFAULT_DEGREE = LOG_DEGREE_SEC )
const ( SLT_LOCAL = C.SLT_LOCAL //local file-log SLT_NET = C.SLT_NET //remote net-log )
SLOG-TYPE
const ( SL_VERBOSE = iota //C.SL_VERBOSE SL_DEBUG SL_INFO SL_ERR SL_FATAL )
SLOG-LEVEL
const ( SLD_SEC = iota //C.SLD_SEC second SLD_MILL //milli sec SLD_MIC //micro sec SLD_NANO //nano sec )
SLOG-DEGREE
const ( SLF_PREFIX = C.SLF_PREFIX //each log has prefix like [time level] SLF_RAW = C.SLF_RAW //raw info )
SLOG-FORMAT
Variables ¶
This section is empty.
Functions ¶
func SLog ¶
** Log @sld:opened slog descriptor @log_level:refer to SL_XX.the level of this log.If log_level < filt_level(slog_open),it will not printed. @RETVALUE: -1:failed(err msg can be found in slog.log). 0:success
func SLogBytes ¶
** Wrapper Log of write bytes directly @sld:opened slog descriptor @log_level:refer to SL_XX.the level of this log.If log_level < filt_level(slog_open),it will not printed. @RETVALUE: -1:failed(err msg can be found in slog.log). 0:success
func SLogChgAttr ¶
** Change Attr @sld:opened slog descriptor @filt_level:refer to SLOG_LEVEL. If No Change Sets to -1. @degree:refer to SLOG_DEGREE. If No Change sets to -1. @size:Change log size. If No Change sets to -1. @rotate:Change Max Rotate Number. If No Change sets to -1. @format:Change format of single item. If No change sets to -1.
func SLogLocalOpen ¶
func SLogLocalOpen(filt_level int, log_name string, format int, log_degree int, log_size int, rotate int) int
***********API**************** ** Open A Local SLOG Descriptor @filt_level:Log filter.Only Print Log if LOG_LEVEL >= filt_level. @log_name:log file (include path) @format:format of log. if 0 then default is SLF_PREFIX,if sets to SLF_RAW,then print raw info. @log_degree:refer SLD_xx.the timing degree of log. if 0 then default by seconds. @log_size:max single log_file size.if 0 then sets to defaut 20M @rotate:log file rotate limit.if 0 then sets to default 5 *RETVALUE: *-1: FAILED *>=0:ALLOCATED SLD(SLOG Descriptor)
func SLogNetOpen ¶
** Open A Net SLOG Descriptor(Peer should listen on a UDP Port) @filt_level:Log filter.Only Print Log if LOG_LEVEL >= filt_level. @log_name:log file (include path) @format:format of log. if 0 then default is SLF_PREFIX,if sets to SLF_RAW,then print raw info. @log_degree:refer SLD_xx.the timing degree of log. if 0 then default by seconds. @log_size:max single log_file size.if 0 then sets to defaut 20M @rotate:log file rotate limit.if 0 then sets to default 5 *RETVALUE: *-1: FAILED *>=0:ALLOCATED SLD(SLOG Descriptor)
func SLogString ¶
** Wrapper Log of write string directly @sld:opened slog descriptor @log_level:refer to SL_XX.the level of this log.If log_level < filt_level(slog_open),it will not printed. @RETVALUE: -1:failed(err msg can be found in slog.log). 0:success
Types ¶
type LogHeader ¶
type LogHeader interface { Log(log_level int, format string, arg ...interface{}) Debug(format string, arg ...interface{}) Info(format string, arg ...interface{}) Err(format string, arg ...interface{}) Fatal(format string, arg ...interface{}) ChgAttr(attr int, value int) int Close() }
for local log
type NetLog ¶
type NetLog interface { //("|" , a , b , c) => a|b|c as a log Log(split string, arg ...string) Close() }
for net log
type SLogPen ¶
type SLogPen struct {
// contains filtered or unexported fields
}
type SNetLogPen ¶
type SNetLogPen struct {
// contains filtered or unexported fields
}
func OpenNetLog ¶
func OpenNetLog(hash_key int, peer_addr []string, method int, log_degree int) (*SNetLogPen, []string)
Open a NetLog handler * @hash_key: if method is hash this is neccessary * @peer_addr: recv net-log servers * @method:refer NETLOG_METHOD_XX default:rand * @log_degree: LOG_DEGREE_XX. default:second * @return:*SNetLogPen , err_addr:which addr is invalid
func (*SNetLogPen) Close ¶
func (nlp *SNetLogPen) Close()
func (*SNetLogPen) Log ¶
func (nlp *SNetLogPen) Log(sep string, arg ...string)