log

package
v0.0.57 Latest Latest
Warning

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

Go to latest
Published: May 23, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupSourceLocation added in v0.0.54

func SetupSourceLocation(entry *logging.Entry, callDepth int)

SetupSourceLocation sets up the entry.SourceLocation field if it is not already set. If callDepth is 0, then the source location of the caller to SetupSourceLocation will be used. If 1, then the caller of that caller, etc, etc.

Types

type Client

type Client interface {
	// Logger returns a logger with a provided logID.
	Logger(logID string) Logger
	// Close waits for all opened loggers to be flushed and closes the client.
	Close() error
}

Client is used to provision new loggers and close underlying connections during shutdown.

func NewStandardClient

func NewStandardClient(writer io.Writer) Client

NewStandardClient returns a new StandardClient that writes to writer.

type GkeClient

type GkeClient struct {
	// contains filtered or unexported fields
}

GkeClient is a Logging client. A Client is associated with a single Cloud project.

func NewGkeClient

func NewGkeClient(ctx context.Context, parent string) (GkeClient, error)

NewGkeClient returns a new logging client associated with the provided parent. 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.

Note: NewGkeClient uses WriteScope.

func (GkeClient) Close

func (g GkeClient) Close() error

Close waits for all opened loggers to be flushed and closes the client.

func (GkeClient) Logger

func (g GkeClient) Logger(logID string) Logger

Logger returns a Logger that will write entries with the given log ID, such as "syslog". 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.

func (GkeClient) Ping added in v0.0.27

func (g GkeClient) Ping(ctx context.Context) error

Ping reports whether the client's connection to the logging service and the authentication configuration are valid. To accomplish this, Ping writes a log entry "ping" to a log named "ping".

type GkeLogger

type GkeLogger struct {
	*logging.Logger
}

A GkeLogger is used to write log messages to a single log.

type Logger

type Logger interface {
	// StandardLogger returns a *log.Logger for a given severity.
	StandardLogger(severity logging.Severity) *log.Logger
	// Log queues a single log entry.
	Log(entry logging.Entry)
	// Flush flushes the queued log entries.
	Flush() error
	// LogSync logs the Entry synchronously.
	LogSync(ctx context.Context, entry logging.Entry) error
}

Logger logs entries to a single log.

type StandardClient

type StandardClient struct {
	// contains filtered or unexported fields
}

StandardClient wraps a standard logger. See *log.Logger

func (StandardClient) Close

func (s StandardClient) Close() error

Close implements log.Client.Close(). For StandardClient, it is a no-op.

func (StandardClient) Logger

func (s StandardClient) Logger(logID string) Logger

Logger returns a logger with a provided logID.

Jump to

Keyboard shortcuts

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