golog

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: MIT Imports: 20 Imported by: 3

README

golog

4everland internal go service log format

Install

go get github.com/4everland/golog

Usage

 logger := golog.NewFormatStdLogger(
        os.Stdout, 
        golog.WithFilterLevel(log.LevelInfo), 
        golog.WithServerName("name"", "version"))

Documentation

Index

Constants

View Source
const (
	OTLPProtocol     = "OTEL_EXPORTER_OTLP_PROTOCOL"
	OTLPEndpoint     = "OTEL_EXPORTER_OTLP_ENDPOINT"
	OTLPCompression  = "OTEL_EXPORTER_OTLP_COMPRESSION"
	OTLPHeaders      = "OTEL_EXPORTER_OTLP_HEADERS"
	OTLPPath         = "OTEL_EXPORTER_OTLP_PATH"
	OTLPExportEnable = "OTEL_AGENT_ENABLED"
	OTLPExportRatio  = "OTEL_EXPORTER_OTLP_RATIO"
)

Variables

This section is empty.

Functions

func InitOTLPTracer added in v0.0.2

func InitOTLPTracer(serverName string, ratio float64) error

InitOTLPTracer init export by env headers example: x-otel-project=,x-otel-access-id=,x-otel-access-key=

func RatioFromEnv added in v0.0.7

func RatioFromEnv() float64

func WithFilterLevel

func WithFilterLevel(level kratoslog.Level) func(logger *stdLogger)

func WithServerName

func WithServerName(name string, version string) func(logger *stdLogger)

Types

type Logger

type Logger interface {
	Log(level kratoslog.Level, keyvals ...interface{}) error
}

Logger is a logger interface.

func NewFormatStdLogger

func NewFormatStdLogger(w io.Writer, opts ...Option) Logger

NewFormatStdLogger new a logger with writer.

type Option

type Option func(logger *stdLogger)

type ReportInterface

type ReportInterface interface {
	Report(msg string)
}

Jump to

Keyboard shortcuts

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