logger

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2019 License: BSD-3-Clause Imports: 6 Imported by: 3

README

📋 Logger - the way we do logging

Logger wraps around the stdlib log package adding extra capabilities like Stackdriver Error Reporting.

Convenience methods

  • LogIfErr
  • FatalIfErr
  • ReportIfErr

Documentation

Overview

Package logger is the way we do logging.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Log

type Log struct {
	*log.Logger
	*errorreporting.Client
}

Log is a wrapper on the stdlib log pkg which includes the Stackdriver Error Reporting client.

func New

func New(prefix string) *Log

New returns an initialized Log with defaults setup.

func NewWithReporting

func NewWithReporting(prefix string, gcpReporting *errorreporting.Client) *Log

New returns an initialized Log with defaults setup.

func (*Log) FatalIfErr

func (log *Log) FatalIfErr(err error)

FatalIfErr panics if the error value is not nil.

func (*Log) LogIfErr

func (log *Log) LogIfErr(err error)

LogIfErr logs if the error value is not nil.

func (*Log) ReportIfErr

func (log *Log) ReportIfErr(err error, user string, req *http.Request)

ReportIfErr sends an error report to Stackdriver Error Reporting.

Jump to

Keyboard shortcuts

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