envlion

package
v10.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2022 License: Apache-2.0, MIT Imports: 8 Imported by: 0

Documentation

Overview

Package envlion provides simple utilities to setup lion from the environment.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Main

func Main(do func(interface{}) error, appEnv interface{}, decoders ...env.Decoder)

Main runs env.Main along with Setup.

func Setup

func Setup() error

Setup gets the Env from the environment, and then calls SetupEnv.

func SetupEnv

func SetupEnv(env Env) error

SetupEnv sets up logging for the given Env.

Types

type Env

type Env struct {
	// The log app name, will default to app if not set.
	LogAppName string `env:"LOG_APP_NAME,default=app"`
	// The level to log at, must be one of DEBUG, INFO, WARN, ERROR, FATAL, PANIC.
	LogLevel string `env:"LOG_LEVEL"`
	// LogDisableStderr says to disable logging to stderr.
	LogDisableStderr bool `env:"LOG_DISABLE_STDERR"`
	// The syslog network, either udp or tcp.
	// Must be set with SyslogAddress.
	// If not set and LogDir not set, logs will be to stderr.
	SyslogNetwork string `env:"SYSLOG_NETWORK"`
	// The syslog host:port.
	// Must be set with SyslogNetwork.
	// If not set and LogDir not set, logs will be to stderr.
	SyslogAddress string `env:"SYSLOG_ADDRESS"`
	// The current token.
	// Must be set with CurrentSyslogNetwork or CurrentStderr.
	CurrentToken string `env:"CURRENT_TOKEN"`
	// The current syslog host:port.
	// Must be set with CurrentToken.
	CurrentSyslogAddress string `env:"CURRENT_SYSLOG_ADDRESS"`
	// Output logs in current format to stdout.
	CurrentStdout bool `env:"CURRENT_STDOUT"`
}

Env defines a struct for environment variables that can be parsed with go.pedge.io/env.

Jump to

Keyboard shortcuts

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