v1

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Counter errors.
	ErrCounterCreateFailed  = Error("Failed to create counter.")
	ErrCounterDestroyFailed = Error("Failed to remove counter.")

	// CounterVec errors.
	ErrCounterVecCreateFailed = Error("Failed to create counter vector.")

	// Errors used for testing.
	ErrNoMatch = Error("No alert matched in alert config.")

	// User Registry errors.
	ErrUserNotFoundByID       = Error("User not found by ID.")
	ErrUserNotFoundByUsername = Error("User not found by Username.")

	// Authorization errors.
	ErrUnauthorizedAPI = Error("Unauthorized API access.")

	// Generic gRPC errors.
	ErrRecordAlreadyExists        = Error("Record already exists.")
	ErrRecordConversionToDBFailed = Error("Record conversion to DB format failed.")
	ErrRecordConversionToPBFailed = Error("Record conversion to PB format failed.")
	ErrRecordDeleteFailed         = Error("Record delete failed.")
	ErrRecordDoesNotExist         = Error("Record does not exist.")
	ErrRecordInsertFailed         = Error("Record insert failed.")
	ErrRecordUpdateFailed         = Error("Record update failed.")

	// Message validation errors.
	ErrClientMsgValidationFailed = Error("Client message validation failed.")
	ErrServerMsgValidationFailed = Error("Server message validation failed.")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Config  *AppConfig
	Secrets *AppSecrets
}

App represents the application's metadata, configuration and secrets.

type AppConfig

type AppConfig struct {
	LogLevel   string `json:"log_level"            yaml:"log_level"`
	ServerHost string `json:"server_host"          yaml:"server_host"`
	ServerPort int    `json:"server_port"          yaml:"server_port"`
}

AppConfig represents the application's configuration.

type AppSecrets

type AppSecrets struct {
	AuthToken string `json:"auth_token"    yaml:"auth_token"`
}

AppSecrets represents the application's secrets.

type Error

type Error string

Error represents an error.

func (Error) Error

func (e Error) Error() string

Error returns the error as a string.

type Logger

type Logger interface {
	Fatalf(message string, args ...interface{})
	Panicf(message string, args ...interface{})
	Debugf(message string, args ...interface{})
	Errorf(message string, args ...interface{})
	Infof(message string, args ...interface{})
	LogLevel() string
	SetLevel(string)
	Tracef(message string, args ...interface{})
	Warningf(message string, args ...interface{})

	WithError(error) Logger
	WithField(string, interface{}) Logger
	WithFields(map[string]interface{}) Logger
	AutoClearFields(bool)

	SetOutput(io.Writer)
}

Methods required for a logger.

Jump to

Keyboard shortcuts

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