core: Index | Files

package log

import ""


Package Files

access.go log.go log.pb.go logger.go


const (
    AccessAccepted = AccessStatus("accepted")
    AccessRejected = AccessStatus("rejected")


var Severity_name = map[int32]string{
    0:  "Unknown",
    1:  "Error",
    2:  "Warning",
    3:  "Info",
    4:  "Debug",
var Severity_value = map[string]int32{
    "Unknown": 0,
    "Error":   1,
    "Warning": 2,
    "Info":    3,
    "Debug":   4,

func Record Uses

func Record(msg Message)

Record writes a message into log stream.

func RegisterHandler Uses

func RegisterHandler(handler Handler)

RegisterHandler register a new handler as current log handler. Previous registered handler will be discarded.

type AccessMessage Uses

type AccessMessage struct {
    From   interface{}
    To     interface{}
    Status AccessStatus
    Reason interface{}
    Email  string

func (*AccessMessage) String Uses

func (m *AccessMessage) String() string

type AccessStatus Uses

type AccessStatus string

type GeneralMessage Uses

type GeneralMessage struct {
    Severity Severity
    Content  interface{}

GeneralMessage is a general log message that can contain all kind of content.

func (*GeneralMessage) String Uses

func (m *GeneralMessage) String() string

String implements Message.

type Handler Uses

type Handler interface {
    Handle(msg Message)

Handler is the interface for log handler.

func NewLogger Uses

func NewLogger(logWriterCreator WriterCreator) Handler

NewLogger returns a generic log handler that can handle all type of messages.

type Message Uses

type Message interface {
    String() string

Message is the interface for all log messages.

type Severity Uses

type Severity int32
const (
    Severity_Unknown Severity = 0
    Severity_Error   Severity = 1
    Severity_Warning Severity = 2
    Severity_Info    Severity = 3
    Severity_Debug   Severity = 4

func (Severity) EnumDescriptor Uses

func (Severity) EnumDescriptor() ([]byte, []int)

func (Severity) String Uses

func (x Severity) String() string

type Writer Uses

type Writer interface {
    Write(string) error

Writer is the interface for writing logs.

type WriterCreator Uses

type WriterCreator func() Writer

WriterCreator is a function to create LogWriters.

func CreateFileLogWriter Uses

func CreateFileLogWriter(path string) (WriterCreator, error)

CreateFileLogWriter returns a LogWriterCreator that creates LogWriter for the given file.

func CreateStdoutLogWriter Uses

func CreateStdoutLogWriter() WriterCreator

CreateStdoutLogWriter returns a LogWriterCreator that creates LogWriter for stdout.

Package log imports 13 packages (graph) and is imported by 48 packages. Updated 2019-07-19. Refresh now. Tools for package owners.