Monorepo for Tangled tangled.org

spindle/models: add NullLogger #1046

merged opened by oppi.li targeting master from op/wyvvzksxqmwq

behaves like io.Discard, and infact, is just a wrapper around io.Discard.

Signed-off-by: oppiliappan me@oppi.li

Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:qfpnj4og54vl56wngdriaxug/sh.tangled.repo.pull/3mdupl2fcey22
+9 -1
Diff #0
+9 -1
spindle/models/logger.go
··· 15 15 ControlWriter(idx int, step Step, stepStatus StepStatus) io.Writer 16 16 } 17 17 18 + type NullLogger struct{} 19 + 20 + func (l NullLogger) Close() error { return nil } 21 + func (l NullLogger) DataWriter(idx int, stream string) io.Writer { return io.Discard } 22 + func (l NullLogger) ControlWriter(idx int, step Step, stepStatus StepStatus) io.Writer { 23 + return io.Discard 24 + } 25 + 18 26 type FileWorkflowLogger struct { 19 27 file *os.File 20 28 encoder *json.Encoder 21 29 mask *SecretMask 22 30 } 23 31 24 - func NewFileWorkflowLogger(baseDir string, wid WorkflowId, secretValues []string) (*FileWorkflowLogger, error) { 32 + func NewFileWorkflowLogger(baseDir string, wid WorkflowId, secretValues []string) (WorkflowLogger, error) { 25 33 path := LogFilePath(baseDir, wid) 26 34 file, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644) 27 35 if err != nil {

History

1 round 0 comments
sign up or login to add to the discussion
oppi.li submitted #0
1 commit
expand
spindle/models: add NullLogger
2/3 failed, 1/3 success
expand
expand 0 comments
pull request successfully merged