Categorygithub.com/ha666/log
modulepackage
0.0.2
Repository: https://github.com/ha666/log.git
Documentation: pkg.go.dev

# README

log

介绍

log

引用包

import (
	"github.com/ha666/log"
)

写入控制台

log.Init(&log.Config{
	Host:       host,
	Stdout:     true,
	IgnorePath: []string{`/\S+/v2-9[0-9\-]*/`},
})

写入文件

log.Init(&log.Config{
	Host:       host,
	Dir:        "/Users/ha666/test/v2-9/lass",
	IgnorePath: []string{`/\S+/v2-9[0-9\-]*/`},
})

写日志

log.Info("ajsdlf")
log.Info("ajsdf:%s", "abc")
log.Error("sajdf:%d", 234)

# Functions

Close close resource.
Debug logs a message at the debug log level.
Debugc logs a message at the debug log level.
Debugv logs a message at the debug log level.
Debugw logs a message with some additional context.
Error logs a message at the error log level.
Errorc logs a message at the error log level.
Errorv logs a message at the error log level.
Errorw logs a message with some additional context.
Fatal logs a message at the fatal log level.
Fatalc logs a message at the fatal log level.
Fatalv logs a message at the error log level.
Fatalw logs a message with some additional context.
Info logs a message at the info log level.
Infoc logs a message at the info log level.
Infov logs a message at the info log level.
Infow logs a message with some additional context.
Init create logger with context.
KV return a log kv for logging field.
KVDuration construct Field with Duration value.
KVFloat32 construct Field with float32 value.
KVFloat64 construct Field with float64 value.
KVInt construct Field with int value.
KVInt64 construct D with int64 value.
KVString construct Field with string value.
KVUint construct Field with uint value.
KVUint64 construct Field with uint64 value.
NewFile crete a file logger.
NewStdout create a stdout log handler.
SetFormat only effective on stdout and file handler %T time format at "15:04:05.999" on stdout handler, "15:04:05 MST" on file handler %t time format at "15:04:05" on stdout handler, "15:04" on file on file handler %D data format at "2006/01/02" %d data format at "01/02" %L log level e.g.
V reports whether verbosity at the call site is at least the requested level.
Warn logs a message at the warning log level.
Warnc logs a message at the warning log level.
Warnv logs a message at the warning log level.
Warnw logs a message with some additional context.

# Structs

Config log config.
FileHandler .
Handlers a bundle for hander with filter function.
StdoutHandler stdout log handler.

# Interfaces

Handler is used to handle log events, outputting them to stdio or sending them to remote services.
Render render log output.

# Type aliases

D represents a map of entry level data used for structured logging.
Level of severity.
Verbose is a boolean type that implements Info, Infov (like Printf) etc.