csvlogger

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2021 License: MIT Imports: 7 Imported by: 0

README

csvlogger

loging struct to csv splited by day.

usage

sample code.
func main() {
	logger, _ := NewLogger("./", "sample")

	type sample struct {
		// export Field.
		Hoge string
		Fuga int
	}

	for i := 0; i < 10; i++ {
		data := sample{
			Hoge: "hoge_" + fmt.Sprint(i),
			Fuga: i,
		}
		logger.Add(&data)
	}
}
result

sample.20210220.csv

Hoge,Fuga
hoge_0,0
hoge_1,1
hoge_2,2
hoge_3,3
hoge_4,4
hoge_5,5
hoge_6,6
hoge_7,7
hoge_8,8
hoge_9,9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(basePath, fileNamme string) (*csvLogger, error)

NewLogger .. Create logger.

Types

This section is empty.

Jump to

Keyboard shortcuts

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