-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add logging * fix nil logger flag * add debugging print for change file paths * remove redundant prints * fix MR's comments * add test for logrus level * apply refactors in config tests * add default case * fix tests' flags initializations
- Loading branch information
Showing
8 changed files
with
100 additions
and
19 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
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 |
---|---|---|
@@ -1,14 +1,16 @@ | ||
package utils | ||
|
||
import "github.com/sirupsen/logrus" | ||
|
||
func GetResultOrPanic[TResult interface{}](result TResult, error error) TResult { | ||
if error != nil { | ||
panic(error) | ||
logrus.Panic(error) // calls panic() after logging | ||
} | ||
return result | ||
} | ||
|
||
func PanicError(error error) { | ||
if error != nil { | ||
panic(error) | ||
logrus.Panic(error) // calls panic() after logging | ||
} | ||
} |
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,8 @@ | ||
package utils | ||
|
||
import "encoding/json" | ||
|
||
func InterfaceToString(obj interface{}) string { | ||
bytes, _ := json.MarshalIndent(obj, "\t", "\t") | ||
return string(bytes) | ||
} |