log

package
v1.9.13 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PREFIX  = "prefix"
	SUFFIX  = "suffix"
	TRACEID = "traceid"
)
View Source
const (
	GREEN  = "green"
	YELLOW = "yellow"
	RED    = "red"
)
View Source
const (
	FILE = "file"
	VIEW = "view"
	SHOW = "show"
)
View Source
const (
	BENCH_LOG = "bench.log"
	DEBUG_LOG = "debug.log"
	ERROR_LOG = "error.log"
	WATCH_LOG = "watch.log"
)
View Source
const BENCH = "bench"
View Source
const DEBUG = "debug"
View Source
const ERROR = "error"
View Source
const LOG = "log"
View Source
const TAIL = "tail"
View Source
const WATCH = "watch"

Variables

View Source
var Index = &ice.Context{Name: LOG, Help: "日志模块", Configs: ice.Configs{
	FILE: {Name: FILE, Help: "日志文件", Value: kit.Dict(
		BENCH, kit.Dict(nfs.PATH, path.Join(ice.VAR_LOG, BENCH_LOG), mdb.LIST, []string{}),
		DEBUG, kit.Dict(nfs.PATH, path.Join(ice.VAR_LOG, DEBUG_LOG), mdb.LIST, []string{ice.LOG_DEBUG}),
		ERROR, kit.Dict(nfs.PATH, path.Join(ice.VAR_LOG, ERROR_LOG), mdb.LIST, []string{ice.LOG_WARN, ice.LOG_ERROR}),
		WATCH, kit.Dict(nfs.PATH, path.Join(ice.VAR_LOG, WATCH_LOG), mdb.LIST, []string{mdb.CREATE, mdb.REMOVE, mdb.INSERT, mdb.DELETE, mdb.MODIFY, mdb.EXPORT, mdb.IMPORT}),
	)},
	VIEW: {Name: VIEW, Help: "日志格式", Value: kit.Dict(
		GREEN, kit.Dict(PREFIX, "\033[32m", SUFFIX, "\033[0m", mdb.LIST, []string{ice.CTX_START, ice.LOG_CMDS}),
		YELLOW, kit.Dict(PREFIX, "\033[33m", SUFFIX, "\033[0m", mdb.LIST, []string{ice.LOG_AUTH, ice.LOG_COST}),
		RED, kit.Dict(PREFIX, "\033[31m", SUFFIX, "\033[0m", mdb.LIST, []string{ice.CTX_CLOSE, ice.LOG_WARN}),
	)},
	SHOW: {Name: SHOW, Help: "日志分流", Value: kit.Dict()},
}, Commands: ice.Commands{
	ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
		ice.Info.Load(m)
		mdb.Confm(m, FILE, nil, func(key string, value ice.Map) {
			kit.For(value[mdb.LIST], func(index int, k string) { m.Conf(SHOW, kit.Keys(k, FILE), key) })
		})
		mdb.Confm(m, VIEW, nil, func(key string, value ice.Map) {
			kit.For(value[mdb.LIST], func(index int, k string) { m.Conf(SHOW, kit.Keys(k, VIEW), key) })
		})
	}},
	ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) {
		ice.Info.Save(m)
	}},
}}

Functions

func Traceid added in v1.6.1

func Traceid(m *ice.Message) (traceid string)

Types

type Frame

type Frame struct {
	// contains filtered or unexported fields
}

func (*Frame) Begin

func (f *Frame) Begin(m *ice.Message, arg ...string)

func (*Frame) Close

func (f *Frame) Close(m *ice.Message, arg ...string)

func (*Frame) Start

func (f *Frame) Start(m *ice.Message, arg ...string)

type Log

type Log struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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