Skip to content

joinself/logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logger

CI

Self logger provides a layer on top of zerolog to initialize it and provide helper functions to easily manage your logging.

Usage

package main

import (
	"context"

	"github.com/joinself/logger"
)

func main() {
	logger.SetGlobalLevel(logger.DEBUG)

	ctx := context.Background()
	ctx = context.WithValue(ctx, "session_id", "190827-30298-901283029-1232131")
	ctx = context.WithValue(ctx, "self_id", "1112223334")

	logger.Debug().Context(ctx).Msg("Yo!")
	// {"level":"debug","severity":100,"session_id":"190827-30298-901283029-1232131","self_id":"1112223334","timestamp":1613043647,"message":"Yo!"}

	logger.Info().Msg("Yo!")
	// {"level":"info","severity":200,"timestamp":1613043647,"message":"Yo!"}}

	logger.Info().Msg("Yo! %s", "Tom")
	// {"level":"info","severity":200,"timestamp":1613044425,"message":"Yo! Tom"}
}

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages