Documentation
¶
Overview ¶
Package def provides default values for both commands and tests.
Index ¶
Constants ¶
View Source
const ( LogServer = "server" // "OpenAPI", "gRPC", "Prometheus metrics", etc. LogRemoteIP = "remoteIP" // IP address. LogAddr = "addr" // host:port. LogHost = "host" // DNS hostname or IPv4/IPv6 address. LogPort = "port" // TCP/UDP port number. LogHTTPMethod = "httpMethod" // GET, POST, etc. LogHTTPStatus = "httpStatus" // Status code: 200, 404, etc. LogFunc = "func" // RPC/event handler method name, REST resource path. LogUserName = "userName" LogGRPCCode = "grpcCode" LogUserID = "userID" )
Log field names.
Variables ¶
View Source
var ( ProgName = strings.TrimSuffix(path.Base(os.Args[0]), ".test") Hostname = "localhost" HostnameInt = "127.0.0.1" )
Constants.
Functions ¶
func Init ¶
func Init() error
Init must be called once before using this package. It provides common initialization for both commands and tests.
func NewContext ¶
NewContext returns context.Background() which contains logger configured for given service.
Types ¶
type Metrics ¶
type Metrics struct {
PanicsTotal prometheus.Counter
MisconfigurationTotal prometheus.Counter
}
Metrics shared by all packages.
func NewMetrics ¶
func NewMetrics(reg *prometheus.Registry) Metrics
NewMetrics registers and returns metrics shared by all packages.
Click to show internal directories.
Click to hide internal directories.