sloggcloud

package module
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: MIT Imports: 8 Imported by: 1

README

slog-gcloud

Some utils for using github.com/monzo/slog in google cloud platform

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProjectID string

Functions

func CloudContextFilter

func CloudContextFilter(r typhon.Request, s typhon.Service) typhon.Response

CloudContextFilter adds data to the context for the Google Cloud Run environment

func CloudContextMiddleware

func CloudContextMiddleware(h http.Handler) http.Handler

func Trace

func Trace(ctx context.Context) string

func WithTrace

func WithTrace(ctx context.Context, r *http.Request, projectID string) context.Context

Types

type Entry

type Entry struct {
	Message  string            `json:"message"`
	Severity string            `json:"severity,omitempty"`
	Trace    string            `json:"logging.googleapis.com/trace,omitempty"`
	Labels   map[string]string `json:"logging.googleapis.com/labels,omitempty"`

	Params map[string]string `json:"params,omitempty"`
}

Entry ...

func NewEntry

func NewEntry(e slog.Event) Entry

func (Entry) String

func (e Entry) String() string

String renders an entry structure to the JSON format expected by Stackdriver.

type StackDriverLogger

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

StackDriverLogger is an implementation of monzo/slog.Logger that emits stackdriver compatible events

func (*StackDriverLogger) Flush

func (l *StackDriverLogger) Flush() error

func (*StackDriverLogger) Log

func (l *StackDriverLogger) Log(evs ...slog.Event)

Jump to

Keyboard shortcuts

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