Documentation ¶
Overview ¶
Package service holds the methods necessary to support implementation of loggers that write to Google cloud service
Index ¶
- Constants
- Variables
- func CloseGroup(status int, labels map[string]string)
- func InitGroup(httpRequest *http.Request) time.Time
- func Log(callDepth int, message string, level logging.Severity, logTime time.Time)
- func LogTime() time.Time
- func SetDebugOutput(w io.Writer)
- func SetMode(mode string)
- func SetMonitoredResource(resourceType string, labels map[string]string)
Constants ¶
const ModeDebug = "debug"
const ModeRelease = "release"
const ModeSilent = "silent"
const ModeTesting = "testing"
Variables ¶
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 Log ¶
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 SetDebugOutput ¶
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`
func SetMonitoredResource ¶ added in v1.0.1
SetMonitoredResource sets the monitored resource that is the source of log entries This accepts the type e.g. "gae_app", "cloud_run_revision" and labels which are simply a map of the resource labels The easiest way to get these values is to check a previous log entry printed by the same resource to CGP logging
Types ¶
This section is empty.