github.com/XiaoMi/Gaea@v1.2.5/log/xlog/interface.go (about)

     1  // Copyright 2019 The Gaea Authors. All Rights Reserved.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package xlog
    16  
    17  // XLogger declares method that log instance should implement.
    18  type XLogger interface {
    19  	// init logger
    20  	Init(config map[string]string) error
    21  
    22  	// reopen logger
    23  	ReOpen() error
    24  
    25  	//设置日志级别, 级别如下: "Debug", "Trace", "Notice", "Warn", "Fatal", "None"
    26  	SetLevel(level string)
    27  
    28  	// set skip
    29  	SetSkip(skip int)
    30  
    31  	// 打印Debug日志. 当日志级别大于Debug时, 不会输出任何日志
    32  	Debug(format string, a ...interface{}) error
    33  
    34  	// 打印Trace日志. 当日志级别大于Trace时, 不会输出任何日志
    35  	Trace(format string, a ...interface{}) error
    36  
    37  	// 打印Notice日志. 当日志级别大于Notice时, 不会输出任何日志
    38  	Notice(format string, a ...interface{}) error
    39  
    40  	// 打印Warn日志. 当日志级别大于Warn时, 不会输出任何日志
    41  	Warn(format string, a ...interface{}) error
    42  
    43  	// 打印Fatal日志. 当日志级别大于Fatal时, 不会输出任何日志
    44  	Fatal(format string, a ...interface{}) error
    45  
    46  	// 打印Debug日志, 需要传入logID. 当日志级别大于Debug时, 不会输出任何日志
    47  	Debugx(logID, format string, a ...interface{}) error
    48  
    49  	// 打印Trace日志, 需要传入logID. 当日志级别大于Trace时, 不会输出任何日志
    50  	Tracex(logID, format string, a ...interface{}) error
    51  
    52  	// 打印Notice日志, 需要传入logID. 当日志级别大于Notice时, 不会输出任何日志
    53  	Noticex(logID, format string, a ...interface{}) error
    54  
    55  	// 打印Warn日志, 需要传入logID. 当日志级别大于Warn时, 不会输出任何日志
    56  	Warnx(logID, format string, a ...interface{}) error
    57  
    58  	// 打印Fatal日志, 需要传入logID. 当日志级别大于Fatal时, 不会输出任何日志
    59  	Fatalx(logID, format string, a ...interface{}) error
    60  
    61  	// 关闭日志库. 注意: 如果没有调用Close()关闭日志库的话, 将会造成文件句柄泄露
    62  	Close()
    63  }