-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Thomas Labarussias <issif_github@gadz.org>
- Loading branch information
Showing
68 changed files
with
566 additions
and
484 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,37 @@ | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
|
||
package utils | ||
|
||
import "fmt" | ||
|
||
const ( | ||
InfoLvl string = "info" | ||
InfoPrefix string = "[INFO] " | ||
ErrorLvl string = "error" | ||
ErrorPrefix string = "[ERROR]" | ||
DebugLvl string = "debug" | ||
DebugPrefix string = "[DEBUG]" | ||
WarningLvl string = "warning" | ||
WarningPrefix string = "[WARN] " | ||
FatalLvl string = "fatal" | ||
FatalPrefix string = "[FATAL]" | ||
) | ||
|
||
func Log(level, output, msg string) { | ||
var prefix string | ||
switch level { | ||
case InfoLvl: | ||
prefix = InfoPrefix | ||
case ErrorLvl: | ||
prefix = ErrorPrefix | ||
case DebugLvl: | ||
prefix = DebugPrefix | ||
case WarningLvl: | ||
prefix = WarningPrefix | ||
} | ||
if output != "" { | ||
fmt.Printf("%v : %v - %v", prefix, output, msg) | ||
} else { | ||
fmt.Printf("%v : %v", prefix, msg) | ||
} | ||
} |
Oops, something went wrong.