sdklog

package
v3.8.1-rc.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitSDKLogger

func InitSDKLogger(
	loggerPrefixName, moduleName string, sdkType, platformID string,
	logLevel int,
	isStdout bool,
	isJson bool,
	logLocation string,
	rotateCount uint,
	rotationTime uint,
	moduleVersion string,
	isSimplify bool,
) error

func SDKDebug

func SDKDebug(ctx context.Context, path string, line string, msg string, keysAndValues ...any)

func SDKError

func SDKError(ctx context.Context, path string, line string, msg string, err error, keysAndValues ...any)

func SDKInfo

func SDKInfo(ctx context.Context, path string, line string, msg string, keysAndValues ...any)

func SDKLog

func SDKLog(ctx context.Context, logLevel int, path string, line string, msg, err string, keysAndValues map[string]string)

func SDKWarn

func SDKWarn(ctx context.Context, path string, line string, msg string, err error, keysAndValues ...any)

Types

type Color

type Color uint8

Color represents a text color.

const (
	Black Color = iota + 30
	Red
	Green
	Yellow
	Blue
	Magenta
	Cyan
	White
)

Foreground colors.

func (Color) Add

func (c Color) Add(s string) string

Add adds the coloring to the given string.

type Logger

type Logger interface {
	Debug(ctx context.Context, msg string, keysAndValues ...any)
	Info(ctx context.Context, msg string, keysAndValues ...any)
	Warn(ctx context.Context, msg string, err error, keysAndValues ...any)
	Error(ctx context.Context, msg string, err error, keysAndValues ...any)
	WithValues(keysAndValues ...any) Logger
	WithName(name string) Logger
	WithCallDepth(depth int) Logger
	ToZap() *zap.SugaredLogger
}

type SDKLogger

type SDKLogger struct {
	// contains filtered or unexported fields
}

func NewSDKLogger

func NewSDKLogger(
	loggerPrefixName, moduleName string, sdkType, platformID string,
	logLevel int,
	isStdout bool,
	isJson bool,
	logLocation string,
	rotateCount uint,
	rotationTime uint,
	moduleVersion string,
	isSimplify bool,
) (*SDKLogger, error)

func (*SDKLogger) Debug

func (l *SDKLogger) Debug(ctx context.Context, msg string, keysAndValues ...any)

func (*SDKLogger) Error

func (l *SDKLogger) Error(ctx context.Context, msg string, err error, keysAndValues ...any)

func (*SDKLogger) Info

func (l *SDKLogger) Info(ctx context.Context, msg string, keysAndValues ...any)

func (*SDKLogger) ToZap

func (l *SDKLogger) ToZap() *zap.SugaredLogger

func (*SDKLogger) Warn

func (l *SDKLogger) Warn(ctx context.Context, msg string, err error, keysAndValues ...any)

func (*SDKLogger) WithCallDepth

func (l *SDKLogger) WithCallDepth(depth int) Logger

func (*SDKLogger) WithName

func (l *SDKLogger) WithName(name string) Logger

func (*SDKLogger) WithValues

func (l *SDKLogger) WithValues(keysAndValues ...any) Logger

Jump to

Keyboard shortcuts

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