Popularity
2.9
Growing
Activity
2.5
Growing
40
1
7
Programming language: Go
License: MIT License
Tags:
Logging
Latest version: v1.2.0
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 -
tail
A Go package striving to emulate the features of the BSD tail program. -
seelog
logging functionality with flexible dispatching, filtering, and formatting. -
logutils
Utilities for slightly better logging in Go (Golang) extending the standard logger. -
Onelog
Dead simple, super fast, zero allocation and modular logger for Golang -
logrusiowriter
io.Writer implementation using logrus logger. -
loggo
A logging library for Go. Doesn't use the built in go log standard library, but instead offers a replacement. -
rollingwriter
RollingWriter is an auto-rotate io.Writer implementation with multi policies to provide log file rotation. -
httpretty
Pretty-prints your regular HTTP requests on your terminal for debugging (similar to http.DumpRequest). -
ozzo-log
High performance logging supporting log severity, categorization, and filtering. Can send filtered log messages to various targets (e.g. console, network, mail). -
xlog
A structured logger for net/context aware HTTP handlers with flexible dispatching. -
sqldb-logger
A logger for Go SQL database driver without modify existing *sql.DB stdlib usage. -
logur
An opinionated logger interface and collection of logging best practices with adapters and integrations for well-known libraries (logrus, go-kit log, zap, zerolog, etc). -
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. -
stdlog
Stdlog is an object-oriented library providing leveled logging. It is very useful for cron jobs. -
mlog
A simple logging module for go, with 5 levels, an optional rotating logfile feature and stdout/stderr output. -
distillog
distilled levelled logging (think of it as stdlib + log levels). -
slf
The Structured Logging Facade (SLF) for Go (like SLF4J but structured and for Go) -
journald
Go implementation of systemd Journal's native API for logging. -
Kiwi Logs&Context
Structured logger & context keeper for Go language -
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 -
logmatic
Colorized logger for Golang with dynamic log level configuration. -
glo
PHP Monolog inspired logging facility with identical severity levels. -
go-rethinklogger
Automatically persists all the logs of your Go application inside RethinkDB. -
kemba
A tiny debug logging tool inspired by debug, great for CLI tools and applications. -
MrZ's go-logger
Easy to use, extendable and super fast logging package for Go -
gone/log
Fast, extendable, full-featured, std-lib source compatible log library.
Scout APM - Leading-edge performance monitoring starting at $39/month
Scout APM uses tracing logic that ties bottlenecks to source code so you know the exact line of code causing performance issues and can get back to building a great product faster.
Sponsored
scoutapm.com
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