hud: github.com/jwilder/hud/logger Index | Files

package logger

import "github.com/jwilder/hud/logger"

The syslog package provides a syslog client. Unlike the core log/syslog package it uses the newer rfc5424 syslog protocol, reliably reconnects on failure, and supports TLS encrypted TCP connections.

Index

Package Files

console.go formatter.go socket.go syslog.go

Constants

const (
    StdDateFormat     = "2006-01-02T15:04:05.999Z"
    Rfc5424DateFormat = "2006-01-02T15:04:05.999999Z07:00"
)

Variables

var (
    Colors = []string{
        ansi.ColorGreen,
        ansi.ColorOrange,
        ansi.ColorCyan,
        ansi.ColorYellow,
        ansi.ColorLightBlue,
        ansi.ColorLightPurple,
        ansi.ColorWhite,
    }
)
var ErrPriority = fmt.Errorf("Not a designated priority")

Returned when looking up a non-existant facility or severity

type ConsoleLogger Uses

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

func NewConsoleLogger Uses

func NewConsoleLogger(w io.Writer, formatter Formatter) (*ConsoleLogger, error)

func (*ConsoleLogger) HandleLog Uses

func (l *ConsoleLogger) HandleLog(msg *docker.LogRecord) error

type ExtendedFormatter Uses

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

func (*ExtendedFormatter) Format Uses

func (f *ExtendedFormatter) Format(rec *docker.LogRecord) ([]byte, error)

func (*ExtendedFormatter) SetColored Uses

func (f *ExtendedFormatter) SetColored(colored bool)

type Formatter Uses

type Formatter interface {
    SetColored(colored bool)
    Format(log *docker.LogRecord) ([]byte, error)
}

type JSONFormatter Uses

type JSONFormatter struct{}

func (*JSONFormatter) Format Uses

func (f *JSONFormatter) Format(log *docker.LogRecord) ([]byte, error)

func (*JSONFormatter) SetColored Uses

func (f *JSONFormatter) SetColored(colored bool)

type Priority Uses

type Priority int

A Syslog Priority is a combination of Severity and Facility.

const (
    SevEmerg Priority = iota
    SevAlert
    SevCrit
    SevErr
    SevWarning
    SevNotice
    SevInfo
    SevDebug
)

RFC5424 Severities

const (
    LogKern Priority = iota
    LogUser
    LogMail
    LogDaemon
    LogAuth
    LogSyslog
    LogLPR
    LogNews
    LogUUCP
    LogCron
    LogAuthPriv
    LogFTP
    LogNTP
    LogAudit
    LogAlert
    LogAt
    LogLocal0
    LogLocal1
    LogLocal2
    LogLocal3
    LogLocal4
    LogLocal5
    LogLocal6
    LogLocal7
)

RFC5424 Facilities

func Facility Uses

func Facility(name string) (Priority, error)

Facility returns the named facility. It returns ErrPriority if the facility does not exist.

func Severity Uses

func Severity(name string) (Priority, error)

Severity returns the named severity. It returns ErrPriority if the severity does not exist.

type ShortFormatter Uses

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

func (*ShortFormatter) Format Uses

func (f *ShortFormatter) Format(rec *docker.LogRecord) ([]byte, error)

func (*ShortFormatter) SetColored Uses

func (f *ShortFormatter) SetColored(colored bool)

type SocketLogger Uses

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

A Logger is a connection to a syslog server. It reconnects on error. Clients log by sending a Packet to the logger.Packets channel.

func NewSocketLogger Uses

func NewSocketLogger(dest string, rootCAs *x509.CertPool, formatter Formatter) (*SocketLogger, error)

func (*SocketLogger) HandleLog Uses

func (l *SocketLogger) HandleLog(log *docker.LogRecord) error

type SyslogFormatter Uses

type SyslogFormatter struct {
    Facility Priority
    Severity Priority
    Hostname string
    Newline  bool
    // contains filtered or unexported fields
}

func (*SyslogFormatter) Format Uses

func (f *SyslogFormatter) Format(rec *docker.LogRecord) ([]byte, error)

func (*SyslogFormatter) SetColored Uses

func (f *SyslogFormatter) SetColored(colored bool)

Package logger imports 14 packages (graph) and is imported by 1 packages. Updated 2016-11-06. Refresh now. Tools for package owners.