go-cronowriter alternatives and similar packages
Based on the "Logging" category.
Alternatively, view go-cronowriter alternatives based on common mentions on social networks and blogs.
-
spew
Implements a deep pretty printer for Go data structures to aid in debugging -
seelog
Seelog is a native Go logging library that provides flexible asynchronous dispatching, filtering, and formatting. -
logxi
A 12-factor app logger built for performance and happy development -
go-logger
Simple logger for Go programs. Allows custom formats for messages. -
rollingwriter
Rolling writer is an IO util for auto rolling write in go. -
sqldb-logger
A logger for Go SQL database driver without modifying existing *sql.DB stdlib usage. -
httpretty
Package httpretty prints the HTTP requests you make with Go pretty on your terminal. -
loggo
A logging library for Go. Doesn't use the built in go log standard library, but instead offers a replacement. -
logrusiowriter
io.Writer implementation using logrus logger -
ozzo-log
A Go (golang) package providing high-performance asynchronous logging, message filtering by severity and category, and multiple message targets. -
logex
An golang log lib, supports tracking and level, wrap by standard log lib -
gologger
Simple easy to use log lib for go, logs in Colored Cosole, Simple Console, File or Elasticsearch. -
noodlog
๐ Parametrized JSON logging library in Golang which lets you obfuscate sensitive data and marshal any kind of content. -
mlog
A simple logging module for go, with a rotating file feature and console logging. -
journald
Go implementation of systemd Journal's native API for logging -
slf
The Structured Logging Facade (SLF) for Go (like SLF4J but structured and for Go) -
Kiwi Logs&Context
Fast, structured, with filters and dynamic sinks. No levels. Logger & context keeper for Go language ๐ฅ It smell like a mushroom. -
logmatic
Colorized logger for Golang with dynamic log level configuration -
slog
The reference implementation of the Structured Logging Facade (SLF) for Go -
gomol
Gomol is a library for structured, multiple-output logging for Go with extensible logging outputs -
kemba
A tiny debug logging tool. Ideal for CLI tools and command applications. Inspired by https://github.com/visionmedia/debug -
MrZ's go-logger
:mag: Easy to use, extendable and super fast logging package for Go
TestGPT | Generating meaningful tests for busy devs
Do you think we are missing an alternative of go-cronowriter or a related project?
README
cronowriter
This is a simple file writer that it writes message to the specified format path.
The file path is constructed based on current date and time, like cronolog.
This project follows the Semantic Versioning.
Installation
$ go get -u github.com/utahta/go-cronowriter
Documentation
API documentation can be found here.
The format specifications can be found here.
Examples
import "github.com/utahta/go-cronowriter"
w := cronowriter.MustNew("/path/to/example.log.%Y%m%d")
w.Write([]byte("test"))
// output file
// /path/to/example.log.20170204
You can specify the directory as below
w := cronowriter.MustNew("/path/to/%Y/%m/%d/example.log")
w.Write([]byte("test"))
// output file
// /path/to/2017/02/04/example.log
with Location
w := cronowriter.MustNew("/path/to/example.log.%Z", writer.WithLocation(time.UTC))
w.Write([]byte("test"))
// output file
// /path/to/example.log.UTC
with Symlink
w := cronowriter.MustNew("/path/to/example.log.%Y%m%d", writer.WithSymlink("/path/to/example.log"))
w.Write([]byte("test"))
// output file
// /path/to/example.log.20170204
// /path/to/example.log -> /path/to/example.log.20170204
with Mutex
w := cronowriter.MustNew("/path/to/example.log.%Y%m%d", writer.WithMutex())
no use Mutex
w := cronowriter.MustNew("/path/to/example.log.%Y%m%d", writer.WithNopMutex())
with Debug (stdout and stderr)
w := cronowriter.MustNew("/path/to/example.log.%Y%m%d", writer.WithDebug())
w.Write([]byte("test"))
// output file, stdout and stderr
// /path/to/example.log.20170204
with Init
w := cronowriter.MustNew("/path/to/example.log.%Y%m%d", writer.WithInit())
// open the file when New() method is called
// /path/to/example.log.20170204
Example using with zap
uber-go/zap
package main
import (
"github.com/uber-go/zap"
"github.com/utahta/go-cronowriter"
)
func main() {
w1 := cronowriter.MustNew("/tmp/example.log.%Y%m%d")
w2 := cronowriter.MustNew("/tmp/internal_error.log.%Y%m%d")
l := zap.New(
zap.NewJSONEncoder(),
zap.Output(zap.AddSync(w1)),
zap.ErrorOutput(zap.AddSync(w2)),
)
l.Info("test")
}
// output
// /tmp/example.log.20170204
// {"level":"info","ts":1486198722.1201255,"msg":"test"}
Contributing
- Fork it ( https://github.com/utahta/go-cronowriter/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request