logpolicy

package
v1.8.6 Latest Latest
Warning

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

Go to latest
Published: May 27, 2021 License: BSD-3-Clause Imports: 31 Imported by: 24

Documentation

Overview

Package logpolicy manages the creation or reuse of logtail loggers, caching collection instance state on disk for use on future runs of programs on the same machine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Collection string
	PrivateID  logtail.PrivateID
	PublicID   logtail.PublicID
}

Config represents an instance of logs in a collection.

func ConfigFromBytes

func ConfigFromBytes(jsonEnc []byte) (*Config, error)

ConfigFromBytes parses a a Config from its JSON encoding.

func (*Config) ToBytes

func (c *Config) ToBytes() []byte

ToBytes returns the JSON representation of c.

type Policy

type Policy struct {
	// Logtail is the logger.
	Logtail *logtail.Logger
	// PublicID is the logger's instance identifier.
	PublicID logtail.PublicID
}

Policy is a logger and its public ID.

func New

func New(collection string) *Policy

New returns a new log policy (a logger and its instance ID) for a given collection name.

func (*Policy) Close

func (p *Policy) Close()

Close immediately shuts down the logger.

func (*Policy) SetVerbosityLevel added in v1.4.0

func (p *Policy) SetVerbosityLevel(level int)

SetVerbosityLevel controls the verbosity level that should be written to stderr. 0 is the default (not verbose). Levels 1 or higher are increasingly verbose.

It should not be changed concurrently with log writes.

func (*Policy) Shutdown

func (p *Policy) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the logger, finishing any current log upload if it can be done before ctx is canceled.

Jump to

Keyboard shortcuts

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