logging

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2019 License: BSD-2-Clause Imports: 5 Imported by: 2

README

gizmo-stackdriver-logging

Build Status

This repository provides a library that aims to provide a StackDriver-integrated logging library that follows Gizmo's conventions for loading configuration from the environment.

For an example of this library being used in a real-world Gizmo project, check out the video-transcoding-api: https://github.com/NYTimes/video-transcoding-api/blob/57e3ff55ca4b0577668a7288f6800d71c8c5d5e5/main.go#L23-L32.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Level string `envconfig:"LOGGING_LEVEL" default:"info"`

	// List of environment variables that should be included in all log
	// lines.
	EnvironmentVariables []string `envconfig:"LOGGING_ENVIRONMENT_VARIABLES"`

	// Send logs to StackDriver?
	SendToStackDriver bool `envconfig:"LOGGING_SEND_TO_STACKDRIVER"`

	// StackDriver error reporting options. When present, error logs are
	// going to be reported as errors on StackDriver.
	StackDriverErrorServiceName string `envconfig:"LOGGING_STACKDRIVER_ERROR_SERVICE_NAME"`
	StackDriverErrorLogName     string `envconfig:"LOGGING_STACKDRIVER_ERROR_LOG_NAME" default:"error_log"`

	// When StackDriverCredentialsFile is set, the logger will use the
	// Google logging API to send the logs. Otherwise the fluentd Agent is
	// used.
	StackDriverCredentialsFile string `envconfig:"LOGGING_STACKDRIVER_CREDENTIALS_FILE"`
}

Config contains configuration for logging level and services integration.

func (*Config) Logger

func (c *Config) Logger() (*logrus.Logger, error)

Logger returns a logrus logger with the features defined in the config.

Jump to

Keyboard shortcuts

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