Version: v0.0.0-...-f928e5d Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2023 License: MIT Imports: 6 Imported by: 2




This section is empty.


This section is empty.


func IsSameDay

func IsSameDay(t1, t2 time.Time) bool

func IsSameHour

func IsSameHour(t1, t2 time.Time) bool


type Config

type Config struct {
	DidClose           func(path string, didRotate bool)
	PathIfShouldRotate func(creationTime time.Time, now time.Time) string

type File

type File struct {

	// Path is the path of the current file
	Path string
	// contains filtered or unexported fields

func New

func New(config *Config) (*File, error)

func NewDaily

func NewDaily(dir string, didClose func(path string, didRotate bool)) (*File, error)

func NewHourly

func NewHourly(dir string, didClose func(path string, didRotate bool)) (*File, error)

func (*File) Close

func (f *File) Close() error

func (*File) Flush

func (f *File) Flush() error

Flush flushes the file

func (*File) Write

func (f *File) Write(d []byte) (int, error)

Write writes data to a file

func (*File) Write2

func (f *File) Write2(d []byte, flush bool) (string, int64, int, error)

Write2 writes data to a file, optionally flushes. To enable users to later seek to where the data was written, it returns name of the file where data was written, offset at which the data was written, number of bytes and error

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL