logs

package
Version: v1.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2020 License: Apache-2.0 Imports: 6 Imported by: 537

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Log = func() Logs {
	p, _ := path.Split(config.LOG)

	d, err := os.Stat(p)
	if err != nil || !d.IsDir() {
		if err := os.MkdirAll(p, 0777); err != nil {

		}
	}

	ml := &mylog{
		BeeLogger: logs.NewLogger(config.LOG_CAP, config.LOG_FEEDBACK_LEVEL),
	}

	ml.BeeLogger.EnableFuncCallDepth(config.LOG_LINEINFO)

	ml.BeeLogger.SetLevel(config.LOG_LEVEL)

	ml.BeeLogger.Async(config.LOG_ASYNC)

	ml.BeeLogger.SetLogger("console", map[string]interface{}{
		"level": config.LOG_CONSOLE_LEVEL,
	})

	if config.LOG_SAVE {
		err = ml.BeeLogger.SetLogger("file", map[string]interface{}{
			"filename": config.LOG,
		})
		if err != nil {
			fmt.Printf("日志文档创建失败:%v", err)
		}
	}

	return ml
}()

Functions

This section is empty.

Types

type Logs

type Logs interface {
	// 设置实时log信息显示终端
	SetOutput(show io.Writer) Logs
	// 暂停输出日志
	Rest()
	// 恢复暂停状态,继续输出日志
	GoOn()
	// 是否开启日志捕获副本模式
	EnableStealOne(bool)
	// 按先后顺序实时捕获日志副本,每次返回1条,normal标记日志是否被关闭
	StealOne() (level int, msg string, normal bool)
	// 正常关闭日志输出
	Close()
	// 返回运行状态,如0,"RUN"
	Status() (int, string)
	DelLogger(adaptername string) error
	SetLogger(adaptername string, config map[string]interface{}) error

	// 以下打印方法除正常log输出外,若为客户端或服务端模式还将进行socket信息发送
	Debug(format string, v ...interface{})
	Informational(format string, v ...interface{})
	App(format string, v ...interface{})
	Notice(format string, v ...interface{})
	Warning(format string, v ...interface{})
	Error(format string, v ...interface{})
	Critical(format string, v ...interface{})
	Alert(format string, v ...interface{})
	Emergency(format string, v ...interface{})
}

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL