![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
github.com/utahta/go-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.
$ go get -u github.com/utahta/go-cronowriter
API documentation can be found here.
The format specifications can be found here.
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
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"}
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.