jenlog

package module
v1.7.7 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

README

jenlog

Go Report Card

Go Reference

Generic logging library

Main attribute is a KISS structured logging mechanism facilitating the Stackdriver logging format.

stackdriver docs

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Console

type Console struct{}

Console stock

func NewConsole added in v1.0.8

func NewConsole(daemon, version string) (*Console, error)

NewConsole Allocates memory

func (*Console) Criticalf

func (c *Console) Criticalf(format string, args ...interface{})

Criticalf is system failure

func (*Console) Debugf

func (c *Console) Debugf(format string, args ...interface{})

Debugf ...

func (*Console) Errorf

func (c *Console) Errorf(format string, args ...interface{})

Errorf ....

func (*Console) Infof

func (c *Console) Infof(format string, args ...interface{})

Infof logs a message with INFO severity level

type Context

type Context struct {
	ReportLocation *ReportLocation `json:"reportLocation,omitempty"`
}

Context is required by the Stackdriver Error format

type Logger

type Logger interface {
	Infof(message string, args ...interface{})
	Debugf(message string, args ...interface{})
	Errorf(message string, args ...interface{})
	Criticalf(message string, args ...interface{})
}

Logger interface, console, syslog or stackdriver format

type ReportLocation

type ReportLocation struct {
	FilePath     string `json:"filePath"`
	FunctionName string `json:"functionName"`
	LineNumber   int    `json:"lineNumber"`
}

ReportLocation is required by the Stackdriver Error format

type ServiceContext

type ServiceContext struct {
	Service string `json:"service,omitempty"`
	Version string `json:"version,omitempty"`
}

ServiceContext is required by the Stackdriver Error format.

type Stackdriver

type Stackdriver struct {
	Severity       string          `json:"severity"`
	EventTime      string          `json:"eventTime"`
	Message        string          `json:"message"`
	ServiceContext *ServiceContext `json:"serviceContext,omitempty"`
	Context        *Context        `json:"context,omitempty"`
	Stacktrace     string          `json:"stacktrace,omitempty"`
}

Stackdriver format, see cloud.google.com/error-reporting/docs/formatting-error-messages#formatting_requirements

func NewStackdriver added in v1.0.8

func NewStackdriver(daemon, version string) (*Stackdriver, error)

NewStackdriver allocates memory

func (*Stackdriver) Criticalf

func (s *Stackdriver) Criticalf(format string, args ...interface{})

Criticalf is system failure

func (*Stackdriver) Debugf

func (s *Stackdriver) Debugf(format string, args ...interface{})

Debugf logs a message with DEBUG severity level

func (*Stackdriver) Errorf

func (s *Stackdriver) Errorf(format string, args ...interface{})

Errorf prints out a message with ERROR severity level + picked up by stackdriver error reporting

func (*Stackdriver) Infof

func (s *Stackdriver) Infof(format string, args ...interface{})

Infof logs a message with INFO severity level

type Syslog

type Syslog struct {
	*syslog.Writer
}

Syslog contains writer connection to a syslog server

func NewSyslog added in v1.0.8

func NewSyslog(daemon, version string) (*Syslog, error)

NewSyslog allocates memory

func (*Syslog) Criticalf

func (s *Syslog) Criticalf(format string, args ...interface{})

Criticalf logs a message with severity

func (*Syslog) Debugf

func (s *Syslog) Debugf(format string, args ...interface{})

Debugf logs a message with severity LOG_DEBUG

func (*Syslog) Errorf

func (s *Syslog) Errorf(format string, args ...interface{})

Errorf logs a message with severity LOG_ERR

func (*Syslog) Infof

func (s *Syslog) Infof(format string, args ...interface{})

Infof logs a message with severity LOG_INFO

Jump to

Keyboard shortcuts

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