Back to godoc.org
github.com/cloudfoundry/gosteno

Package gosteno

v0.0.0 (0c8581c)
Latest Go to latest
Published: Apr 23, 2015 | License: Apache-2.0 | Module: github.com/cloudfoundry/gosteno

Index

Package Files

Constants

const (
	EXCLUDE_NONE = 0

	EXCLUDE_LEVEL = 1 << (iota - 1)
	EXCLUDE_TIMESTAMP
	EXCLUDE_FILE
	EXCLUDE_LINE
	EXCLUDE_METHOD
	EXCLUDE_DATA
	EXCLUDE_MESSAGE
)
const (
	MaxMessageSize  = 1024 * 3
	TruncatePostfix = "..."
)

Variables

var (
	LOG_OFF    = defineLogLevel("off", 0)
	LOG_FATAL  = defineLogLevel("fatal", 1)
	LOG_ERROR  = defineLogLevel("error", 5)
	LOG_WARN   = defineLogLevel("warn", 10)
	LOG_INFO   = defineLogLevel("info", 15)
	LOG_DEBUG  = defineLogLevel("debug", 16)
	LOG_DEBUG1 = defineLogLevel("debug1", 17)
	LOG_DEBUG2 = defineLogLevel("debug2", 18)
	LOG_ALL    = defineLogLevel("all", 30)
)

func ClearLoggerRegexp

func ClearLoggerRegexp()

func EnterTestMode

func EnterTestMode(logLevel ...LogLevel)

func Init

func Init(c *Config)

func SetLoggerRegexp

func SetLoggerRegexp(pattern string, level LogLevel) error

type BaseLogger

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

func (*BaseLogger) Level

func (l *BaseLogger) Level() LogLevel

func (*BaseLogger) Log

func (l *BaseLogger) Log(x LogLevel, m string, d map[string]interface{})

type Codec

type Codec interface {
	EncodeRecord(record *Record) ([]byte, error)
}

func NewJsonCodec

func NewJsonCodec() Codec

type Config

type Config struct {
	Sinks     []Sink
	Level     LogLevel
	Codec     Codec
	EnableLOC bool
}

type IOSink

type IOSink struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewFileSink

func NewFileSink(path string) *IOSink

func NewIOSink

func NewIOSink(file *os.File) *IOSink

func (*IOSink) AddRecord

func (x *IOSink) AddRecord(record *Record)

func (*IOSink) Flush

func (x *IOSink) Flush()

func (*IOSink) GetCodec

func (x *IOSink) GetCodec() Codec

func (*IOSink) SetCodec

func (x *IOSink) SetCodec(codec Codec)

type JsonCodec

type JsonCodec struct {
}

func (*JsonCodec) EncodeRecord

func (j *JsonCodec) EncodeRecord(record *Record) ([]byte, error)

type JsonPrettifier

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

func NewJsonPrettifier

func NewJsonPrettifier(flag int) *JsonPrettifier

func (*JsonPrettifier) DecodeJsonLogEntry

func (p *JsonPrettifier) DecodeJsonLogEntry(logEntry string) (*Record, error)

func (*JsonPrettifier) EncodeRecord

func (p *JsonPrettifier) EncodeRecord(record *Record) ([]byte, error)

type L

type L interface {
	Level() LogLevel
	Log(x LogLevel, m string, d map[string]interface{})
}

type LogLevel

type LogLevel struct {
	Name     string
	Priority int
}

func GetLogLevel

func GetLogLevel(name string) (LogLevel, error)

func (LogLevel) MarshalJSON

func (x LogLevel) MarshalJSON() ([]byte, error)

func (LogLevel) String

func (l LogLevel) String() string

func (*LogLevel) UnmarshalJSON

func (x *LogLevel) UnmarshalJSON(data []byte) error

type Logger

type Logger struct {
	sync.Mutex
	L
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger(name string) *Logger

func (*Logger) Copy

func (l *Logger) Copy() (rv *Logger)

func (*Logger) Debug

func (l *Logger) Debug(m string)

func (*Logger) Debug1

func (l *Logger) Debug1(m string)

func (*Logger) Debug1d

func (l *Logger) Debug1d(d map[string]interface{}, m string)

func (*Logger) Debug1df

func (l *Logger) Debug1df(d map[string]interface{}, f string, a ...interface{})

func (*Logger) Debug1f

func (l *Logger) Debug1f(f string, a ...interface{})

func (*Logger) Debug2

func (l *Logger) Debug2(m string)

func (*Logger) Debug2d

func (l *Logger) Debug2d(d map[string]interface{}, m string)

func (*Logger) Debug2df

func (l *Logger) Debug2df(d map[string]interface{}, f string, a ...interface{})

func (*Logger) Debug2f

func (l *Logger) Debug2f(f string, a ...interface{})

func (*Logger) Debugd

func (l *Logger) Debugd(d map[string]interface{}, m string)

func (*Logger) Debugdf

func (l *Logger) Debugdf(d map[string]interface{}, f string, a ...interface{})

func (*Logger) Debugf

func (l *Logger) Debugf(f string, a ...interface{})

func (*Logger) Error

func (l *Logger) Error(m string)

func (*Logger) Errord

func (l *Logger) Errord(d map[string]interface{}, m string)

func (*Logger) Errordf

func (l *Logger) Errordf(d map[string]interface{}, f string, a ...interface{})

func (*Logger) Errorf

func (l *Logger) Errorf(f string, a ...interface{})

func (*Logger) Fatal

func (l *Logger) Fatal(m string)

func (*Logger) Fatald

func (l *Logger) Fatald(d map[string]interface{}, m string)

func (*Logger) Fataldf

func (l *Logger) Fataldf(d map[string]interface{}, f string, a ...interface{})

func (*Logger) Fatalf

func (l *Logger) Fatalf(f string, a ...interface{})

func (*Logger) Get

func (l *Logger) Get(k string) (rv interface{})

func (*Logger) Info

func (l *Logger) Info(m string)

func (*Logger) Infod

func (l *Logger) Infod(d map[string]interface{}, m string)

func (*Logger) Infodf

func (l *Logger) Infodf(d map[string]interface{}, f string, a ...interface{})

func (*Logger) Infof

func (l *Logger) Infof(f string, a ...interface{})

func (*Logger) Log

func (l *Logger) Log(x LogLevel, m string, d map[string]interface{})

func (*Logger) Set

func (l *Logger) Set(k string, v interface{})

func (*Logger) Warn

func (l *Logger) Warn(m string)

func (*Logger) Warnd

func (l *Logger) Warnd(d map[string]interface{}, m string)

func (*Logger) Warndf

func (l *Logger) Warndf(d map[string]interface{}, f string, a ...interface{})

func (*Logger) Warnf

func (l *Logger) Warnf(f string, a ...interface{})

type Record

type Record struct {
	Timestamp RecordTimestamp        `json:"timestamp"`
	Pid       int                    `json:"process_id"`
	Source    string                 `json:"source"`
	Level     LogLevel               `json:"log_level"`
	Message   string                 `json:"message"`
	Data      map[string]interface{} `json:"data"`
	File      string                 `json:"file,omitempty"`
	Line      int                    `json:"line,omitempty"`
	Method    string                 `json:"method,omitempty"`
}

func NewRecord

func NewRecord(s string, l LogLevel, m string, d map[string]interface{}) *Record

type RecordTimestamp

type RecordTimestamp float64

func (RecordTimestamp) MarshalJSON

func (t RecordTimestamp) MarshalJSON() ([]byte, error)

type Sink

type Sink interface {
	AddRecord(record *Record)
	Flush()

	SetCodec(codec Codec)
	GetCodec() Codec
}

type Syslog

type Syslog struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewSyslogSink

func NewSyslogSink(namespace string) *Syslog

func (*Syslog) AddRecord

func (s *Syslog) AddRecord(record *Record)

func (*Syslog) Flush

func (s *Syslog) Flush()

func (*Syslog) GetCodec

func (s *Syslog) GetCodec() Codec

func (*Syslog) SetCodec

func (s *Syslog) SetCodec(codec Codec)

type TestingSink

type TestingSink struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func GetMeTheGlobalTestSink

func GetMeTheGlobalTestSink() *TestingSink

func NewTestingSink

func NewTestingSink() *TestingSink

func (*TestingSink) AddRecord

func (tSink *TestingSink) AddRecord(record *Record)

func (*TestingSink) Flush

func (tSink *TestingSink) Flush()

func (*TestingSink) GetCodec

func (tSink *TestingSink) GetCodec() Codec

func (*TestingSink) Records

func (tSink *TestingSink) Records() []*Record

func (*TestingSink) SetCodec

func (tSink *TestingSink) SetCodec(codec Codec)
Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier