Documentation ¶
Index ¶
Constants ¶
View Source
const ( AccessAccepted = AccessStatus("accepted") AccessRejected = AccessStatus("rejected") )
Variables ¶
View Source
var Severity_name = map[int32]string{
0: "Unknown",
1: "Error",
2: "Warning",
3: "Info",
4: "Debug",
}
View Source
var Severity_value = map[string]int32{
"Unknown": 0,
"Error": 1,
"Warning": 2,
"Info": 3,
"Debug": 4,
}
Functions ¶
func RegisterHandler ¶ added in v1.1.0
func RegisterHandler(handler Handler)
RegisterHandler register a new handler as current log handler. Previous registered handler will be discarded.
Types ¶
type AccessMessage ¶ added in v1.1.0
type AccessMessage struct { From interface{} To interface{} Status AccessStatus Reason interface{} }
func (*AccessMessage) String ¶ added in v1.1.0
func (m *AccessMessage) String() string
type AccessStatus ¶ added in v0.9.1
type AccessStatus string
type GeneralMessage ¶ added in v1.1.0
type GeneralMessage struct { Severity Severity Content interface{} }
GeneralMessage is a general log message that can contain all kind of content.
func (*GeneralMessage) String ¶ added in v1.1.0
func (m *GeneralMessage) String() string
String implements Message.
type Handler ¶ added in v1.1.0
type Handler interface {
Handle(msg Message)
}
Handler is the interface for log handler.
func NewLogger ¶ added in v1.1.0
func NewLogger(logWriterCreator WriterCreator) Handler
NewLogger returns a generic log handler that can handle all type of messages.
type Message ¶ added in v1.1.0
type Message interface {
String() string
}
Message is the interface for all log messages.
type Severity ¶ added in v1.1.0
type Severity int32
func (Severity) EnumDescriptor ¶ added in v1.1.0
type WriterCreator ¶ added in v1.1.0
type WriterCreator func() Writer
WriterCreator is a function to create LogWriters.
func CreateFileLogWriter ¶ added in v1.1.0
func CreateFileLogWriter(path string) (WriterCreator, error)
CreateFileLogWriter returns a LogWriterCreator that creates LogWriter for the given file.
func CreateStdoutLogWriter ¶ added in v1.1.0
func CreateStdoutLogWriter() WriterCreator
CreateStdoutLogWriter returns a LogWriterCreator that creates LogWriter for stdout.
Click to show internal directories.
Click to hide internal directories.