app

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(lvl zerolog.Level) zerolog.Logger

NewLogger sets up the zerolog.Logger

Types

type Application

type Application struct {
	// EnvName is the Environment Name
	EnvName EnvName
	// Mock denotes whether or not the app is being "mocked" and
	// stubbed responses are being returned for various components
	// within
	Mock bool
	// Datastorer is an interface type meant to be the
	// persistence mechanism. It can be a
	// SQL database (PostgreSQL) or a mock database
	Datastorer datastore.Datastorer
	// Logger
	Logger zerolog.Logger
}

Application contains the app configurations and Datastore

func NewApplication

func NewApplication(en EnvName, ds datastore.Datastorer, logger zerolog.Logger) *Application

NewApplication initializes an Application struct with Mock set to false

func NewMockedApplication

func NewMockedApplication(en EnvName, ds datastore.Datastorer, logger zerolog.Logger) *Application

NewMockedApplication initializes an Application struct with Mock set to true

type EnvName

type EnvName uint8

EnvName is the environment Name int representation Using iota, 1 (Production) is the lowest, 2 (Staging) is 2nd lowest, and so on...

const (
	Production EnvName = iota + 1 // Production (1)
	Staging                       // Staging (2)
	QA                            // QA (3)
	Local                         // Local (4)
)

EnvName of environment.

func (EnvName) String

func (n EnvName) String() string

type GCPSeverityHook

type GCPSeverityHook struct{}

The GCPSeverityHook struct allows mapping of zerolog Levels to GCP Severity levels for logging

func (GCPSeverityHook) Run

func (h GCPSeverityHook) Run(e *zerolog.Event, level zerolog.Level, msg string)

Run method is used to satisfy the zerolog.Hook interface

Jump to

Keyboard shortcuts

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