log

package
v0.0.42 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Copyright © 2020 A. Jensen <jensen.aaro@gmail.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright © 2020 A. Jensen <jensen.aaro@gmail.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright © 2020 A. Jensen <jensen.aaro@gmail.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright © 2020 A. Jensen <jensen.aaro@gmail.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// Logger returns a logger with a provided logID. If logID is empty, then DefaultLogID will be used.
	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

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
}

Logger logs entries to a single log.

type MultiClient

type MultiClient []Client

MultiClient wraps multiple clients. Each operation on a MultiClient is executed on each of its underlying clients.

func (MultiClient) Close

func (mc MultiClient) Close() error

func (MultiClient) Logger

func (mc MultiClient) Logger(logID string) Logger

type MultiLogger

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

MultiLogger wraps multiple loggers. Each operation on a MultiLogger is executed on each of its underlying loggers.

func (MultiLogger) Flush

func (m MultiLogger) Flush() error

func (MultiLogger) Log

func (m MultiLogger) Log(entry logging.Entry)

func (MultiLogger) StandardLogger

func (m MultiLogger) StandardLogger(severity logging.Severity) *log.Logger

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

func (StandardClient) Logger

func (s StandardClient) Logger(logID string) Logger

Jump to

Keyboard shortcuts

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