Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable logging info to stdout (#1195)
Signed-off-by: cyrgim <migeon.work@gmail.com>
- Loading branch information
Showing
6 changed files
with
77 additions
and
34 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,36 @@ | ||
package log | ||
|
||
import ( | ||
"log" | ||
"os" | ||
) | ||
|
||
var ( | ||
infoLogger *log.Logger | ||
errorLogger *log.Logger | ||
) | ||
|
||
func init() { | ||
infoLogger = log.New(os.Stderr, "", 0) | ||
errorLogger = log.New(os.Stderr, "", 0) | ||
} | ||
|
||
func SetInfoToStdout() { | ||
infoLogger.SetOutput(os.Stdout) | ||
} | ||
|
||
func Infof(format string, v ...interface{}) { | ||
infoLogger.Printf(format, v...) | ||
} | ||
|
||
func Errorf(format string, v ...interface{}) { | ||
errorLogger.Printf(format, v...) | ||
} | ||
|
||
func Fatal(v ...any) { | ||
errorLogger.Fatal(v...) | ||
} | ||
|
||
func Panic(v ...any) { | ||
errorLogger.Panic(v...) | ||
} |