Documentation ¶
Overview ¶
Package cronowriter provides 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.
Installation
go get github.com/utahta/go-cronowriter
Format ¶
The format specifications can be found here: https://github.com/lestrrat/go-strftime#supported-conversion-specifications
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CronoWriter ¶
type CronoWriter struct {
// contains filtered or unexported fields
}
A CronoWriter writes message to a set of output files.
func MustNew ¶
func MustNew(pattern string, options ...Option) *CronoWriter
MustNew is a convenience function equivalent to New that panics on failure instead of returning an error.
func New ¶
func New(pattern string, options ...Option) (*CronoWriter, error)
New returns a CronoWriter with the given pattern and options.
func (*CronoWriter) Path ¶ added in v1.1.0
func (c *CronoWriter) Path() string
Path returns the current writing file path.
type Option ¶
type Option func(*CronoWriter)
A Option with CronoWriter.
func WithInit ¶
func WithInit() Option
WithInit enables its creates output file when CronoWriter initialize.
func WithLocation ¶
WithLocation set the location to loc.
func WithNopMutex ¶
func WithNopMutex() Option
WithNopMutex disables its uses sync.Mutex when file writing.
func WithSymlink ¶
WithSymlink enables its creates a symbolic link to the specify pattern.