Skip to content

Instantly share code, notes, and snippets.

@dhruvr
Last active October 9, 2019 18:13
Show Gist options
  • Save dhruvr/a27b84017ee9c66ef486ecb331eab436 to your computer and use it in GitHub Desktop.
Save dhruvr/a27b84017ee9c66ef486ecb331eab436 to your computer and use it in GitHub Desktop.
//f represnts io.file
// incase I don't need lumberjack and want to
// write to both Stdout and file
multi := io.MultiWriter(os.Stdout, f)
l := ConfigureLogrus(multi)
// in case I don't need lumberjack and want to
// write to file only
l := ConfigureLogrus(f)
// incase I don't need lumberjack and want to
// write to stdout only
l := ConfigureLogrus(os.Stdout)
//in case I want lumberjack and stdout
//lets say l is logrus instance
multi := io.MultiWriter(os.Stdout, l)
j := ConfigureLogrus(l)
and so on.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment