common

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package common contains common utilities and functions used by the service.

Index

Constants

This section is empty.

Variables

View Source
var Version = "dev"

Functions

func GetEnvInt

func GetEnvInt(key string, defaultValue int) int

func SetupLogger

func SetupLogger(opts *LoggingOpts) (log *httplog.Logger)

Types

type LoggingOpts

type LoggingOpts struct {
	ServiceName string

	// Whether to log in JSON format
	JSON bool

	// Whether to log debug messages
	Debug bool

	// Concise mode includes fewer log details during the request flow. For example excluding details like
	// request content length, user-agent and other details. This is useful if during development your console is too noisy.
	Concise bool

	// RequestHeaders enables logging of all request headers, however sensitive headers like authorization, cookie and set-cookie are hidden.
	RequestHeaders bool

	// Tags are additional fields included at the root level of all logs. These can be useful for example the commit hash of a build, or an environment name like prod/stg/dev
	Tags map[string]string
}

Jump to

Keyboard shortcuts

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