-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from ichikaway/issue-17-silent-mode
- Loading branch information
Showing
7 changed files
with
67 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package printer | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
var handlePrintf = defaultPrintf | ||
|
||
func Printf(format string, a ...interface{}) { | ||
handlePrintf(format, a...) | ||
} | ||
|
||
func SilentModeOn() { | ||
handlePrintf = printerNothing | ||
} | ||
|
||
func defaultPrintf(format string, a ...interface{}) { | ||
fmt.Printf(format, a...) | ||
} | ||
|
||
func printerNothing(format string, a ...interface{}) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package printer | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
) | ||
|
||
func ErrorPrintf(format string, a ...interface{}) { | ||
fmt.Fprintf(os.Stderr, format, a...) | ||
} |