| 
8 | 8 | 	"fmt"  | 
9 | 9 | 	"io"  | 
10 | 10 | 	slog "log"  | 
11 |  | -	"os"  | 
12 | 11 | 
 
  | 
13 | 12 | 	"aahframework.org/config.v0"  | 
14 | 13 | )  | 
@@ -92,19 +91,19 @@ func Println(format string, v ...interface{}) {  | 
92 | 91 | // Fatal logs message as `FATAL` and call to os.Exit(1).  | 
93 | 92 | func Fatal(v ...interface{}) {  | 
94 | 93 | 	std.output(levelFatal, 3, nil, v...)  | 
95 |  | -	os.Exit(1)  | 
 | 94 | +	exit(1)  | 
96 | 95 | }  | 
97 | 96 | 
 
  | 
98 | 97 | // Fatalf logs message as `FATAL` and call to os.Exit(1).  | 
99 | 98 | func Fatalf(format string, v ...interface{}) {  | 
100 | 99 | 	std.output(levelFatal, 3, &format, v...)  | 
101 |  | -	os.Exit(1)  | 
 | 100 | +	exit(1)  | 
102 | 101 | }  | 
103 | 102 | 
 
  | 
104 | 103 | // Fatalln logs message as `FATAL` and call to os.Exit(1).  | 
105 |  | -func Fatalln(format string, v ...interface{}) {  | 
106 |  | -	std.output(levelFatal, 3, &format, v...)  | 
107 |  | -	os.Exit(1)  | 
 | 104 | +func Fatalln(v ...interface{}) {  | 
 | 105 | +	std.output(levelFatal, 3, nil, v...)  | 
 | 106 | +	exit(1)  | 
108 | 107 | }  | 
109 | 108 | 
 
  | 
110 | 109 | // Panic logs message as `PANIC` and call to panic().  | 
@@ -150,6 +149,40 @@ func SetPattern(pattern string) error {  | 
150 | 149 | 	return std.SetPattern(pattern)  | 
151 | 150 | }  | 
152 | 151 | 
 
  | 
 | 152 | +//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾  | 
 | 153 | +// Logger level and assertion methods  | 
 | 154 | +//___________________________________  | 
 | 155 | + | 
 | 156 | +// Level method returns currently enabled logging level.  | 
 | 157 | +func Level() string {  | 
 | 158 | +	return std.Level()  | 
 | 159 | +}  | 
 | 160 | + | 
 | 161 | +// IsLevelInfo method returns true if log level is INFO otherwise false.  | 
 | 162 | +func IsLevelInfo() bool {  | 
 | 163 | +	return std.IsLevelInfo()  | 
 | 164 | +}  | 
 | 165 | + | 
 | 166 | +// IsLevelError method returns true if log level is ERROR otherwise false.  | 
 | 167 | +func IsLevelError() bool {  | 
 | 168 | +	return std.IsLevelError()  | 
 | 169 | +}  | 
 | 170 | + | 
 | 171 | +// IsLevelWarn method returns true if log level is WARN otherwise false.  | 
 | 172 | +func IsLevelWarn() bool {  | 
 | 173 | +	return std.IsLevelWarn()  | 
 | 174 | +}  | 
 | 175 | + | 
 | 176 | +// IsLevelDebug method returns true if log level is DEBUG otherwise false.  | 
 | 177 | +func IsLevelDebug() bool {  | 
 | 178 | +	return std.IsLevelDebug()  | 
 | 179 | +}  | 
 | 180 | + | 
 | 181 | +// IsLevelTrace method returns true if log level is TRACE otherwise false.  | 
 | 182 | +func IsLevelTrace() bool {  | 
 | 183 | +	return std.IsLevelTrace()  | 
 | 184 | +}  | 
 | 185 | + | 
153 | 186 | func init() {  | 
154 | 187 | 	cfg, _ := config.ParseString("log { }")  | 
155 | 188 | 	std, _ = New(cfg)  | 
 | 
0 commit comments