Code snippets with tests and testable examples for the Go programming language

How to disable log output

Snippets Index - Run code on Go playground - Edit

package main

import (

func Example() {
	// If you want to disable log output (during test for example)
	// you have to set the logger ouput to ioutil.Discard
	// which is an io.Writer on which all Write calls succeed
	// without doing anything
	log.Println("log disabled")
	// Output:

by psampaz - source code - comment below or here