service

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package service holds the methods necessary to support implementation of loggers that write to Google cloud service

Index

Constants

View Source
const ModeDebug = "debug"
View Source
const ModeRelease = "release"
View Source
const ModeSilent = "silent"
View Source
const ModeTesting = "testing"

Variables

View Source
var Writer = alt4Writer{}

Writer can be used to override a normal/default go logger to write it's output to Google cloud logging This writer still respects log grouping if you're grouping your request logs Example log.SetOutput(Writer) for the default log package

Functions

func CloseGroup

func CloseGroup()

func InitGroup

func InitGroup()

func Log

func Log(callDepth int, message string, request *logging.HTTPRequest, labels map[string]string, level logging.Severity, logTime time.Time)

Log Creates a log entry and writes it to Google cloud logging in the background. This function should not be called directly and should instead be used from helper functions under the `log` package.

func LogTime

func LogTime() time.Time

func SetDebugOutput

func SetDebugOutput(w io.Writer)

SetDebugOutput Is used to specify where alt4 emits additional output e.g. when facing network errors. Defaults os.Stderr

func SetMode

func SetMode(mode string)

SetMode Sets the behaviour of alt4 based on the following: `release` - Under this mode logs are written to Google cloud and not emitted to stdout `debug` - Under this mode logs are written to Google cloud and emitted to stdout `testing` - Under this mode logs are not written to Google cloud, just emitted to stdout `silent` - Under this mode logs are not written to Google cloud or emitted to stdout Mode can also be set using environment variable ALT4_MODE Default mode is `release`

Types

This section is empty.

Jump to

Keyboard shortcuts

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