api

package
v0.0.0-...-e560ebb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package api contains the interface that Lucifer uses to talk to the outside world.

This includes LogDog-aware logging (e.g., support for steps even if LogDog is unavailable) and metrics.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client provides the interface that Lucifer uses to talk to the outside world.

Client tracks the current/last LogDog step that was created. If LogDog steps are created or closed in an unusual order, the behavior of this current step tracking is undefined. Note that LogDog is synchronous and cannot handle this anyway. See the logdog package for details on this behavior.

Example (Step_tracking)
lg := logdog.NewTextLogger(os.Stdout)
logdog.ConfigForTest(lg)
c := Client{
	logger: lg,
}
s := c.Step("step1")
defer s.Close()
func(c *Client) {
	s := c.Step("substep2")
	defer s.Close()
	func(c *Client) {
		s := c.Step("substep3")
		defer s.Close()
	}(c)
	func(c *Client) {
		s := c.Step("substep4")
		defer s.Close()
	}(c)
}(&c)
Output:

example: STEP step1
example: STEP step1::substep2
example: STEP step1::substep2::substep3
example: STEP step1::substep2::substep3 OK
example: STEP step1::substep2::substep4
example: STEP step1::substep2::substep4 OK
example: STEP step1::substep2 OK
example: STEP step1 OK

func NewClient

func NewClient(lg logdog.Logger) *Client

NewClient returns a new client.

func (*Client) Logger

func (c *Client) Logger() logdog.Logger

Logger returns the root LogDog logger.

func (*Client) Step

func (c *Client) Step(name string) logdog.Step

Step creates and returns a LogDog step under the currently active step, or the root logger if no step is active.

Jump to

Keyboard shortcuts

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