Skip to content

Instantly share code, notes, and snippets.

@dhruvr
Last active October 9, 2019 18:13
Show Gist options
  • Select an option

  • Save dhruvr/a27b84017ee9c66ef486ecb331eab436 to your computer and use it in GitHub Desktop.

Select an option

Save dhruvr/a27b84017ee9c66ef486ecb331eab436 to your computer and use it in GitHub Desktop.

Revisions

  1. dhruvr revised this gist Oct 9, 2019. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions Callthis.go
    Original file line number Diff line number Diff line change
    @@ -1,17 +1,17 @@
    //f represnts io.file

    // incase in I don't need lumberjack and want to
    // 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 in I don't need lumberjack and want to
    // in case I don't need lumberjack and want to
    // write to file only
    l := ConfigureLogrus(f)


    // incase in I don't need lumberjack and want to
    // incase I don't need lumberjack and want to
    // write to stdout only
    l := ConfigureLogrus(os.Stdout)

  2. dhruvr created this gist Sep 21, 2019.
    23 changes: 23 additions & 0 deletions Callthis.go
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    //f represnts io.file

    // incase in 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 in I don't need lumberjack and want to
    // write to file only
    l := ConfigureLogrus(f)


    // incase in 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.