bootstrap

package
v1.65.6 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: MIT Imports: 8 Imported by: 2

Documentation

Overview

Package bootstrap provides a simple way to bootstrap an application with a managed logging framework, metrics and application context.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bootstrap

func Bootstrap(bindFn BindFunc, opts ...Option) error

Bootstrap is the function in charge of configuring the core components of an application and handling the lifecycle of its context.

Types

type BindFunc

type BindFunc func(context.Context, *zap.Logger, metrics.Client) error

BindFunc represents the function responsible to wire up all components of the application.

type CreateLoggerFunc

type CreateLoggerFunc func() (*zap.Logger, error)

CreateLoggerFunc creates a new logger.

type CreateMetricsClientFunc

type CreateMetricsClientFunc func() (metrics.Client, error)

CreateMetricsClientFunc creates a new metrics client.

type Option

type Option func(*config)

Option is a type alias for a function that configures the application logger.

func WithContext

func WithContext(ctx context.Context) Option

WithContext overrides the application context (useful for testing).

func WithCreateLoggerFunc

func WithCreateLoggerFunc(fn CreateLoggerFunc) Option

WithCreateLoggerFunc overrides the root logger creation function.

func WithCreateMetricsClientFunc

func WithCreateMetricsClientFunc(fn CreateMetricsClientFunc) Option

WithCreateMetricsClientFunc overrides the default metrics client register.

func WithLogger

func WithLogger(l *zap.Logger) Option

WithLogger overrides the default application logger.

Jump to

Keyboard shortcuts

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