logger

command module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

README

logger

Supported log format:
    json(default), txt.
log level :
    debug, info, warn, error 

above values can be set using environment variable :

    LOGGING_LEVEL & LOGGING_FORMAT
Log with traceable context
// Either create a span from existing request context or create a fresh one
package example

import (
	"context"
	"logger/logging"
	"github.com/opentracing/opentracing-go"
)

var log logging.Logger

func myOperation(parentCtx context.Context) {
	span, ctx := opentracing.StartSpanFromContext(parentCtx, "myOperation")
	defer span.Finish()

	log.Info(ctx, "Message")
	
}

####output : {"is_sampled":"false","level":"info","logger":"logging_test.go:70","message":"Message","parent_id":"0","span_id":"54b168451e541edd","timestamp":"2020-12-11T12:02:00.370+02:00","trace_id":"54b168451e541edd"}

####Example execution

Ref :
- https://opentracing.io/guides/golang/quick-start/
- https://github.com/jaegertracing/jaeger-client-go
- https://www.sentinelone.com/blog/jaeger-tracing-tutorial/

Documentation

Overview

Package logger contains ...

Directories

Path Synopsis
Package logger provides compatibility with logging guidelines
Package logger provides compatibility with logging guidelines
Package tracing contains ...
Package tracing contains ...

Jump to

Keyboard shortcuts

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