-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add log wrapper so logging can be disabled
- Loading branch information
Showing
7 changed files
with
86 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Package log wraps the standard library log package. This allows the logging | ||
// functionality to be easily disabled. | ||
package log | ||
|
||
import ( | ||
"log" | ||
|
||
"github.com/z-riley/go-2048-battle/config" | ||
) | ||
|
||
func Print(v ...any) { | ||
if config.Debug { | ||
log.Print(v...) | ||
} | ||
} | ||
|
||
func Printf(format string, v ...any) { | ||
if config.Debug { | ||
log.Printf(format, v...) | ||
} | ||
} | ||
|
||
func Println(v ...any) { | ||
if config.Debug { | ||
log.Println(v...) | ||
} | ||
} | ||
|
||
func Fatal(v ...any) { | ||
if config.Debug { | ||
log.Fatal(v...) | ||
} | ||
} | ||
|
||
func Fatalf(format string, v ...any) { | ||
if config.Debug { | ||
log.Fatalf(format, v...) | ||
} | ||
} | ||
|
||
func Fatalln(v ...any) { | ||
if config.Debug { | ||
log.Fatalln(v...) | ||
} | ||
} | ||
|
||
func Panic(v ...any) { | ||
if config.Debug { | ||
log.Panic(v...) | ||
} | ||
} | ||
|
||
func Panicf(format string, v ...any) { | ||
if config.Debug { | ||
log.Panicf(format, v...) | ||
} | ||
} | ||
|
||
func Panicln(v ...any) { | ||
if config.Debug { | ||
log.Panicln(v...) | ||
} | ||
} |
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