Documentation ¶
Overview ¶
Package logging implements logging functionality for data and errors
Index ¶
- Constants
- func AppendCurrentDay(dst string) string
- func DateDifferent(now, prev *time.Time) bool
- func EnsurePath(dst string) error
- func FloorHMS(t time.Time, h, m, s int) (time.Time, error)
- func PrependDate(t *time.Time, s string) string
- func PrependDatetime(t *time.Time, s string) string
- func PrependTime(t *time.Time, s string) string
- type FileConfig
Constants ¶
const ( // ISOformatMilli - ISO 8601 date and time format, with UTC offset and milliseconds ISOformatMilli = "2006-01-02T15:04:05.000-07:00" // LogSep - globally used separator for parameters in text files LogSep = "\t" )
Variables ¶
This section is empty.
Functions ¶
func AppendCurrentDay ¶
AppendCurrentDay takes a base path and appends subdirectories /year/month/year-month-day
func DateDifferent ¶
DateDifferent checks if the date of time.Time "now" is greater then that of "prev"
func EnsurePath ¶
EnsurePath makes sure that the given path is valid and exists. If it does not exist, the function attempts to create it
func FloorHMS ¶
FloorHMS floors a given time t to multiples of hours h, minuts m and seconds s. nanoseconds are always set to zero. returns a new time.Time.
func PrependDate ¶
PrependDate prepends the current date to a string and separates it with an underscore, YYYYMMDD_, from a given time.Time t
func PrependDatetime ¶
PrependDatetime prepends current date and time to a string, YYYYMMDD_HHMMSS_, from a given time.Time t
Types ¶
type FileConfig ¶
type FileConfig struct { // base directory, where a new year-month-day durectory structure is created BaseDir string // a subdirectory to create for the current day InstrumentDir string // a name extension that will be appended. prefix is always a hms time string. NameExt string // file name creation: floor hours minutes seconds to multiples of... // settting all to 1 will skip flooring in UpdateFname() FloorHMS [3]int // the pointer currently used for writing: ActiveFilePtr *os.File // a header string to write to a new file Header string }
FileConfig holds configuration for a data log file.
func (*FileConfig) UpdateFname ¶
func (c *FileConfig) UpdateFname() (err error)
UpdateFname checks if the current filename is still valid. If filename isn't defined yet or invalid, a new one is created. An error will be returned if file operations fail.