xlog

package
v0.0.0-...-21311fb Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConsoleLogger

func ConsoleLogger(consoleLevel logrus.Level, stackDepth int) *logrus.Logger

ConsoleLogger returns logger which writes everything to file plus console for events above certain level

func NewLogger

func NewLogger(client *GCLClient, t *testing.T, commonFields logrus.Fields) logrus.FieldLogger

NewLogger returns logger which also prints everything to console

func ToJSON

func ToJSON(obj interface{}) string

Types

type GCLClient

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

func NewGCLClient

func NewGCLClient(ctx context.Context, projectID string) (client *GCLClient, err error)

NewGCLClient tries to establish connection to google cloud logger using default authentication method and project ID

func (*GCLClient) Close

func (client *GCLClient) Close()

func (*GCLClient) Context

func (c *GCLClient) Context() context.Context

Context returns context instance this client was initialized with as it may survive local function context which is i.e. cancelled or timed out

func (*GCLClient) Hook

func (c *GCLClient) Hook(name string, fields logrus.Fields) *GCLHook

Hook returns logrus log hook

func (GCLClient) Shorten

func (c GCLClient) Shorten(ctx context.Context, url string) (short string, err error)

Google URL shortener has been discontinued. See https://developers.googleblog.com/2018/03/transitioning-google-url-shortener.html for details. TODO(dmitri): remove or update to use another service

type GCLHook

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

func (*GCLHook) Fire

func (hook *GCLHook) Fire(e *logrus.Entry) error

Fire fires the event to the GCL

func (*GCLHook) Levels

func (hook *GCLHook) Levels() []logrus.Level

Levels returns logging levels supported by logrus

type ProgressReporter

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

func NewProgressReporter

func NewProgressReporter(ctx context.Context, projectID, datasetID, tableID string) (*ProgressReporter, error)

NewProgressReporter initializes progress reporter

func (*ProgressReporter) Put

func (r *ProgressReporter) Put(ctx context.Context, record interface{}) error

type TestingHook

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

func (*TestingHook) Fire

func (hook *TestingHook) Fire(e *logrus.Entry) error

func (*TestingHook) Levels

func (hook *TestingHook) Levels() []logrus.Level

Levels returns logging levels supported by logrus

Jump to

Keyboard shortcuts

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