Skip to content
This repository was archived by the owner on Oct 24, 2024. It is now read-only.

Commit e620f88

Browse files
authored
add specific endpoint for error, warn, fatal, info (#2)
1 parent 0b0632f commit e620f88

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

main.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,33 @@ func main() {
1212
return fmt.Sprintf("Hello! Welcome to %s", c.GetAppName()), nil
1313
})
1414

15+
app.GET("/error", func(c *gofr.Context) (interface{}, error) {
16+
return nil, fmt.Errorf("sample error")
17+
})
18+
19+
app.GET("/warn", func(c *gofr.Context) (interface{}, error) {
20+
c.Logger.Warn("sample warn log")
21+
22+
return nil, nil
23+
})
24+
25+
app.GET("/fatal", func(c *gofr.Context) (interface{}, error) {
26+
c.Logger.Fatal("sample warn log")
27+
28+
return nil, nil
29+
})
30+
31+
app.GET("/debug", func(c *gofr.Context) (interface{}, error) {
32+
c.Logger.Debug("sample debug log")
33+
34+
return nil, nil
35+
})
36+
37+
app.GET("/info", func(c *gofr.Context) (interface{}, error) {
38+
c.Logger.Info("sample info log")
39+
40+
return nil, nil
41+
})
42+
1543
app.Run()
1644
}

0 commit comments

Comments
 (0)