Skip to content

zlogtime is a logging library, which measure the elapsed time of services on-demand.

Notifications You must be signed in to change notification settings

owlsome-official/zlogtime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zlogtime

made-with-Go

zlogtime is a logging library, which measure the elapsed time of services on-demand.

Table of Contents

Installation

  go get -u github.com/owlsome-official/zlogtime

Signatures

var timeTracker zlogtime.ZLogTime = zlogtime.New()

or with configuration

var timeTrackerWithConfig zlogtime.ZLogTime = zlogtime.New(
  zlogtime.Config{
    LogLevel: zerolog.DebugLevel.String()
  }
)

Examples

// Step 1: Defined as global (tools) variable
var (
  timeTracker zlogtime.ZLogTime = zlogtime.New()
)

// Step 2: Call TimeTrack within a function
func FuncName() {
  // NOTE: Always used with "defer"
  defer timeTracker.TimeTrack("NAME", time.Now())
  ...
}

Config

type Config struct {

  // Optional. Default: false
  Hidden bool

  // Optional. Default: "info"
  LogLevel string

  // Optional. Default: "milli". Possible Value: ["nano", "micro", "milli"]
  ElapsedTimeUnit string
}

Default Config

var ConfigDefault = Config{
  Hidden:          false,
  LogLevel:        "info",
  ElapsedTimeUnit: "milli",
}

Dependencies

Example Usage

Please go to example/main.go

Made with ❤️ by watsize

About

zlogtime is a logging library, which measure the elapsed time of services on-demand.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages