stackdriver

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package stackdriver send log lines to Google Stackdriver.

It is based on https://godoc.org/cloud.google.com/go/logging

Index

Constants

View Source
const (
	Name = "stackdriver"
)

Variables

This section is empty.

Functions

func New

func New(tree config.Tree) (log.Printer, error)

Types

type Config

type Config struct {
	// A Parent can take any of the following forms:
	//
	// - projects/PROJECT_ID
	// - folders/FOLDER_ID
	// - billingAccounts/ACCOUNT_ID
	// - organizations/ORG_ID
	//
	// for backwards compatibility, a string with no '/' is also allowed and is
	// interpreted as a project ID.
	// ProjectID sets the Google Cloud Platform project ID.
	Parent string `toml:"parent"`
	// Name sets the name of the log to write to.
	//
	// A log ID must be less than 512 characters long and can only
	// include the following characters: upper and lower case alphanumeric
	// characters: [A-Za-z0-9]; and punctuation characters: forward-slash,
	// underscore, hyphen, and period.
	LogID string `toml:"log_id"`
	// FlushPeriod is the frequence on which log lines are flushed to StackDriver
	FlushPeriod int `toml:"flush_period"`
	// CommonLabels are labels that apply to all log entries written from a Logger,
	// so that you don't have to repeat them in each log entry's Labels field. If
	// any of the log entries contains a (key, value) with the same key that is in
	// CommonLabels, then the entry's (key, value) overrides the one in
	// CommonLabels.
	CommonLabels map[string]string `toml:"common_labels"`
	// Credentials allows to define authentication credentials from the config
	// file instead of the GOOGLE_APPLICATION_CREDENTIALS environment variable.
	Credentials ConfigCredentials `toml:"credentials"`
}

Config defines the filer printer config

type ConfigCredentials added in v1.0.0

type ConfigCredentials struct {
	Type                    string `json:"type" toml:"type"`
	ProjectID               string `json:"project_id" toml:"project_id"`
	PrivateKeyID            string `json:"private_key_id" toml:"private_key_id"`
	PrivateKey              string `json:"private_key" toml:"private_key"`
	ClientEmail             string `json:"client_email" toml:"client_email"`
	ClientID                string `json:"client_id" toml:"client_id"`
	AuthURI                 string `json:"auth_uri" toml:"auth_uri"`
	TokenURI                string `json:"token_uri" toml:"token_uri"`
	AuthProviderX509CertURL string `json:"auth_provider_x509_cert_url" toml:"auth_provider_x509_cert_url"`
	ClientX509CertURL       string `json:"client_x509_cert_url" toml:"client_x509_cert_url"`
}

type Logger

type Logger struct {
	C *logging.Client
	L *logging.Logger
	// contains filtered or unexported fields
}

func (*Logger) Close

func (l *Logger) Close() error

func (*Logger) Print

func (l *Logger) Print(ctx *log.Context, s string) error

Jump to

Keyboard shortcuts

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