log

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2015 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Copyright 2013 CoreOS, Inc. Copyright 2014 Yieldr

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2013 CoreOS, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2013 CoreOS, Inc. Copyright 2014 Yieldr

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2013 CoreOS, Inc. Copyright 2014 Yieldr

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2013 CoreOS, Inc. Copyright 2014 Yieldr

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var (
	BasicFormat  = "%s [%s] %s\n"
	BasicFields  = []string{"time", "priority", "message"}
	RichFormat   = "%s [%9s] %d %s - %s:%s:%d - %s\n"
	RichFields   = []string{"full_time", "priority", "seq", "prefix", "filename", "funcname", "lineno", "message"}
	SyslogFormat = "[%s] %s\n"
	SyslogFields = []string{"priority", "message"}
)

Functions

func Alert

func Alert(v ...interface{})

func Alertf

func Alertf(format string, v ...interface{})

func Critical

func Critical(v ...interface{})

func Criticalf

func Criticalf(format string, v ...interface{})

func Debug

func Debug(v ...interface{})

func Debugf

func Debugf(format string, v ...interface{})

func Emergency

func Emergency(v ...interface{})

func Emergencyf

func Emergencyf(format string, v ...interface{})

func Error

func Error(v ...interface{})

func Errorf

func Errorf(format string, v ...interface{})

func Fatalf

func Fatalf(format string, v ...interface{})

func Fatalln

func Fatalln(v ...interface{})

func FileSink

func FileSink(name string, format string, fields []string) (*fileSink, error)

Returns a new Sink able to buffer output and periodically flush to disk.

func Info

func Info(v ...interface{})

func Infof

func Infof(format string, v ...interface{})

func Notice

func Notice(v ...interface{})

func Noticef

func Noticef(format string, v ...interface{})

func Panicf

func Panicf(format string, v ...interface{})

func Panicln

func Panicln(v ...interface{})

func Printf

func Printf(format string, v ...interface{})

func Println

func Println(v ...interface{})

func SyslogSink

func SyslogSink(p Priority, format string, fields []string) (*syslogSink, error)

func Warning

func Warning(v ...interface{})

func Warningf

func Warningf(format string, v ...interface{})

Types

type Fields

type Fields map[string]interface{}

type Logger

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

Logger is user-immutable immutable struct which can log to several outputs

func New

func New(prefix string, verbose bool, sinks ...Sink) *Logger

New creates a new Logger which logs to all the supplied sinks. The prefix argument is passed to all loggers under the field "prefix" with every log message. If verbose is true, more expensive runtime fields will be computed and passed to loggers. These fields are funcname, lineno, pathname, and filename.

func NewSimple

func NewSimple(sinks ...Sink) *Logger

NewSimple(sinks...) is equivalent to New("", false, sinks...)

func (*Logger) AddSink

func (logger *Logger) AddSink(s Sink)

Appends a new Sink to the Loggers slice of Sinks.

func (*Logger) Alert

func (logger *Logger) Alert(v ...interface{})

func (*Logger) Alertf

func (logger *Logger) Alertf(format string, v ...interface{})

func (*Logger) Critical

func (logger *Logger) Critical(v ...interface{})

func (*Logger) Criticalf

func (logger *Logger) Criticalf(format string, v ...interface{})

func (*Logger) Debug

func (logger *Logger) Debug(v ...interface{})

func (*Logger) Debugf

func (logger *Logger) Debugf(format string, v ...interface{})

func (*Logger) Emergency

func (logger *Logger) Emergency(v ...interface{})

func (*Logger) Emergencyf

func (logger *Logger) Emergencyf(format string, v ...interface{})

func (*Logger) Error

func (logger *Logger) Error(v ...interface{})

func (*Logger) Errorf

func (logger *Logger) Errorf(format string, v ...interface{})

func (*Logger) Fatalf

func (logger *Logger) Fatalf(format string, v ...interface{})

func (*Logger) Fatalln

func (logger *Logger) Fatalln(v ...interface{})

func (*Logger) Info

func (logger *Logger) Info(v ...interface{})

func (*Logger) Infof

func (logger *Logger) Infof(format string, v ...interface{})

func (*Logger) Log

func (logger *Logger) Log(priority Priority, v ...interface{})

This function has an unusual name to aid in finding it while walking the stack. We need to do some dead reckoning from this function to access the caller's stack, so there is a consistent call depth above this function.

func (*Logger) Logf

func (logger *Logger) Logf(priority Priority, format string, v ...interface{})

func (*Logger) Notice

func (logger *Logger) Notice(v ...interface{})

func (*Logger) Noticef

func (logger *Logger) Noticef(format string, v ...interface{})

func (*Logger) Panicf

func (logger *Logger) Panicf(format string, v ...interface{})

func (*Logger) Panicln

func (logger *Logger) Panicln(v ...interface{})

func (*Logger) Printf

func (logger *Logger) Printf(format string, v ...interface{})

func (*Logger) Println

func (logger *Logger) Println(v ...interface{})

func (*Logger) Warning

func (logger *Logger) Warning(v ...interface{})

func (*Logger) Warningf

func (logger *Logger) Warningf(format string, v ...interface{})

type Priority

type Priority int
const (
	PriEmerg Priority = iota
	PriAlert
	PriCrit
	PriErr
	PriWarning
	PriNotice
	PriInfo
	PriDebug
)

func (Priority) String

func (priority Priority) String() string

type Sink

type Sink interface {
	Log(Fields)
}

func NullSink

func NullSink() Sink

func PriorityFilter

func PriorityFilter(priority Priority, target Sink) Sink

func WriterSink

func WriterSink(out io.Writer, format string, fields []string) Sink

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL