MCPcopy Index your code
hub / github.com/git-lfs/git-lfs / LoggerToFile

Method LoggerToFile

tq/meter.go:56–78  ·  view source on GitHub ↗
(name string)

Source from the content-addressed store, hash-verified

54}
55
56func (m *Meter) LoggerToFile(name string) *tools.SyncWriter {
57 printErr := func(err string) {
58 fmt.Fprintln(os.Stderr, tr.Tr.Get("Error creating progress logger: %s", err))
59 }
60
61 if !filepath.IsAbs(name) {
62 printErr(tr.Tr.Get("GIT_LFS_PROGRESS must be an absolute path"))
63 return nil
64 }
65
66 if err := tools.MkdirAll(filepath.Dir(name), m.cfg); err != nil {
67 printErr(err.Error())
68 return nil
69 }
70
71 file, err := os.OpenFile(name, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666)
72 if err != nil {
73 printErr(err.Error())
74 return nil
75 }
76
77 return tools.NewSyncWriter(file)
78}
79
80// NewMeter creates a new Meter.
81func NewMeter(cfg *config.Configuration) *Meter {

Callers 1

LoggerFromEnvMethod · 0.95

Calls 4

MkdirAllFunction · 0.92
NewSyncWriterFunction · 0.92
GetMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected