Documentation ¶
Index ¶
- Constants
- type BugsnagStream
- type EmailStream
- type FileStream
- type LogEntry
- func (l *LogEntry) SetCompletedIn(completedIn string)
- func (l *LogEntry) SetData(data interface{})
- func (l *LogEntry) SetRequest(r *http.Request)
- func (l *LogEntry) SetRequestBody(body []byte)
- func (l *LogEntry) SetResponseBody(body []byte)
- func (l *LogEntry) SetResponseError(err error)
- func (l *LogEntry) SetResponseStatusCode(statusCode int)
- func (l *LogEntry) SetStackTrace(trace string)
- func (l *LogEntry) String() string
- type LogLevel
- type Logger
- func (l *Logger) AddStream(s StreamInterface)
- func (l *Logger) Debug(message string) *LogEntry
- func (l *Logger) DebugF(format string, values ...interface{}) *LogEntry
- func (l *Logger) Error(message string) *LogEntry
- func (l *Logger) ErrorF(format string, values ...interface{}) *LogEntry
- func (l *Logger) Fatal(message string) *LogEntry
- func (l *Logger) FatalF(format string, values ...interface{}) *LogEntry
- func (l *Logger) Info(message string) *LogEntry
- func (l *Logger) InfoF(format string, values ...interface{}) *LogEntry
- func (l *Logger) Log(e *LogEntry)
- func (l *Logger) LogF(level LogLevel, format string, values ...interface{}) *LogEntry
- func (l *Logger) Logln(level LogLevel, message string) *LogEntry
- func (l *Logger) Println(val interface{})
- func (l *Logger) SetGlobalMinLogLevel(minLogLevel LogLevel)
- func (l *Logger) SetSynchronous(sync bool)
- func (l *Logger) Trace(message string) *LogEntry
- func (l *Logger) TraceF(format string, values ...interface{}) *LogEntry
- func (l *Logger) Warn(message string) *LogEntry
- func (l *Logger) WarnF(format string, values ...interface{}) *LogEntry
- type Request
- type Response
- type StdoutStream
- type Stream
- type StreamFilter
- type StreamInterface
Constants ¶
View Source
const ( Fatal LogLevel = 60 Error = 50 Warn = 40 Info = 30 Debug = 20 Trace = 10 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BugsnagStream ¶
type BugsnagStream struct {
*Stream
}
func NewBugsnagStream ¶
func NewBugsnagStream(minLogLevel LogLevel, filter StreamFilter) (result *BugsnagStream)
func (*BugsnagStream) Publish ¶
func (s *BugsnagStream) Publish(l *LogEntry)
type EmailStream ¶
type EmailStream struct { *Stream // contains filtered or unexported fields }
func NewEmailStream ¶
func NewEmailStream(minLogLevel LogLevel, filter StreamFilter, templateSource string, recipient, mailServer string, minimumInterval time.Duration) (result *EmailStream)
func (*EmailStream) Publish ¶
func (s *EmailStream) Publish(l *LogEntry)
type FileStream ¶
type FileStream struct { *Stream // contains filtered or unexported fields }
func NewFileStream ¶
func NewFileStream(minLogLevel LogLevel, filter StreamFilter, path string) (result *FileStream, err error)
func (*FileStream) Publish ¶
func (s *FileStream) Publish(l *LogEntry)
type LogEntry ¶
type LogEntry struct { Data interface{} `json:"data,omitempty"` Error string `json:"error,omitempty"` Hostname string `json:"hostname"` Level LogLevel `json:"level"` Message string `json:"msg"` Name string `json:"name"` ProcessID int `json:"pid"` Request *Request `json:"req,omitempty"` Response *Response `json:"res,omitempty"` StackTrace string `json:"trace,omitempty"` Time time.Time `json:"time"` CompletedIn string `json:"completed_in,omitempty"` Version int `json:"v"` }
func NewLogEntry ¶
func (*LogEntry) SetCompletedIn ¶
func (*LogEntry) SetRequest ¶
func (*LogEntry) SetRequestBody ¶
func (*LogEntry) SetResponseBody ¶
func (*LogEntry) SetResponseError ¶
func (*LogEntry) SetResponseStatusCode ¶
func (*LogEntry) SetStackTrace ¶
type Logger ¶
func NewLogger ¶
func NewLogger(name string, streams []StreamInterface) *Logger
Creates a new logger, given one or more streams
func (*Logger) AddStream ¶
func (l *Logger) AddStream(s StreamInterface)
func (*Logger) SetGlobalMinLogLevel ¶
func (*Logger) SetSynchronous ¶
type StdoutStream ¶
type StdoutStream struct {
*Stream
}
func NewStdoutStream ¶
func NewStdoutStream(minLogLevel LogLevel, filter StreamFilter) *StdoutStream
func (*StdoutStream) Publish ¶
func (s *StdoutStream) Publish(l *LogEntry)
type Stream ¶
type Stream struct { MinLogLevel LogLevel Filter StreamFilter }
type StreamFilter ¶
func FilterGenerator ¶
func FilterGenerator(minStatusCode, maxStatusCode int, excludeStatusCodes []int, allowRequestBody, allowResponseBody bool) StreamFilter
type StreamInterface ¶
type StreamInterface interface {
Publish(*LogEntry)
}
Click to show internal directories.
Click to hide internal directories.