Skip to content

zaydek-old/logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

This is one of the first packages I wrote in Go.

I wanted to have complete control over how a Logger prefixes its output, so I wrote this.

Here's an example:

package main

import (
	"os"
	"time"

	"github.com/zaydek/logger"
)

func main() {
	l := logger.New(os.Stdout, func() string { return time.Now().Format("2006-01-02 15:04:05") })
	l.Println("hello, world!") // e.g. "2006-01-02 15:04:05 hello, world!"
}

Here's a more granular example:

func main() {
	l := logger.New(os.Stderr, func() string { return time.Now().Format("15:04:05.000000") }) // usecs
	l.Println("hello, darkness...") // e.g. "15:04:05.000000 hello, darkness..."
}

About

An (simple) implementation of a logger.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages