logger

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDevelopmentLogger

func NewDevelopmentLogger(serviceName string) (*zap.Logger, error)
Example
package main

import (
	"log"

	"github.com/ecumenos/orbis-socius/pkg/logger"
)

func main() {
	serviceName := "MyService"
	devLogger, err := logger.NewDevelopmentLogger(serviceName)
	if err != nil {
		log.Fatal(err)
	}
	sugaredLogger := devLogger.Sugar()

	sugaredLogger.Infow("Log the logs", "logName", "loggy", "logValue", 1.2)

	// Outputs to stderr: {"level":"info","time":"2018-12-11T21:17:06.128Z","caller":"zapconf/zapconf_test.go:28","msg":"Log the logs","service":"MyService","logName":"loggy","logValue":1.2}
}
Output:

func NewProductionLogger

func NewProductionLogger(serviceName string) (*zap.Logger, error)
Example
package main

import (
	"log"

	"github.com/ecumenos/orbis-socius/pkg/logger"
)

func main() {
	serviceName := "MyService"
	prodLogger, err := logger.NewProductionLogger(serviceName)
	if err != nil {
		log.Fatal(err)
	}
	sugaredLogger := prodLogger.Sugar()

	sugaredLogger.Errorw("Log the logs", "logName", "loggy", "logValue", 1.2)

	// Outputs to stderr: {"level":"error","time":"2018-12-11T21:17:06.128Z","caller":"zapconf/zapconf_test.go:28","msg":"Log the logs","service":"MyService","logName":"loggy","logValue":1.2}
}
Output:

func NewZapLogger

func NewZapLogger(serviceName ecumenosfx.ServiceName, prod bool, lc fx.Lifecycle) (*zap.Logger, error)

func ZapSugared

func ZapSugared(log *zap.Logger) *zap.SugaredLogger

Types

This section is empty.

Jump to

Keyboard shortcuts

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