Content inside fengaldar
(The raw file follows this syntax highlighted file.)
package main
import (
"fmt"
fen "git.ondollo.com/fengaldar"
"net/http"
)
func main() {
fmt.Println(`
NewLogger
`)
l := fen.NewLogger()
func() {
l := l.Trace("given-trace-id")
l.Println("Should be the only line with traceid as given-trace-id")
}()
req, _ := http.NewRequest("", "", nil)
req.Header.Set("trace-id", "http-trace-id")
func() {
l := l.Trace(req.Header.Get("trace-id"))
l.Println("Should be the only line with traceid as http-trace-id")
}()
l.Println("Println")
l.Log("Log")
l.Debug("Debug Log")
l.Info("Info Log")
l.Notice("Notice Log")
l.Warning("Warning Log")
l.Error("Error Log")
l.Critical("Critical Log")
l.Alert("Alert Log")
l.Emergency("Emergency Log")
// Panic and Fatal calls should be explanatory
l.Log("Log with context", fen.LogContext{"a": "b", "c": "d"})
fmt.Println(`
NewLoggerWithOptions(fen.Options{fen.Debug, fen.Debug, "15:04:05.000", fen.Prefix, fen.DefaultContextKey})
`)
l = fen.NewLoggerWithOptions(fen.Options{fen.Debug, fen.Debug, "15:04:05.000", fen.Prefix, fen.DefaultContextKey})
l.Println("Println")
l.Log("Log")
l.Debug("Debug Log")
l.Info("Info Log")
l.Notice("Notice Log")
l.Warning("Warning Log")
l.Error("Error Log")
l.Critical("Critical Log")
l.Alert("Alert Log")
l.Emergency("Emergency Log")
// Panic and Fatal calls should be explanatory
l.Log("Log with context", fen.LogContext{"a": "b", "c": "d"})
fmt.Println(`
NewJSONLogger
`)
l = fen.NewJSONLogger()
func() {
l := l.Trace("given-trace-id")
l.Println("Should be the only line with traceid as given-trace-id")
}()
func() {
l := l.Trace(req.Header.Get("trace-id"))
l.Println("Should be the only line with traceid as http-trace-id")
}()
l.Println("Println")
l.Log("Log")
l.Debug("Debug Log")
l.Info("Info Log")
l.Notice("Notice Log")
l.Warning("Warning Log")
l.Error("Error Log")
l.Critical("Critical Log")
l.Alert("Alert Log")
l.Emergency("Emergency Log")
// Panic and Fatal calls should be explanatory
l.Log("Log with context", fen.LogContext{"a": "b", "c": "d"})
fmt.Println(`
NewJSONLoggerWithOptions(fen.Options{fen.Debug, fen.Debug, "15:04:05.000", fen.Prefix, fen.DefaultContextKey})
`)
l = fen.NewJSONLoggerWithOptions(fen.Options{fen.Debug, fen.Debug, "15:04:05.000", fen.Prefix, fen.DefaultContextKey})
l.Println("Println")
l.Log("Log")
l.Debug("Debug Log")
l.Info("Info Log")
l.Notice("Notice Log")
l.Warning("Warning Log")
l.Error("Error Log")
l.Critical("Critical Log")
l.Alert("Alert Log")
l.Emergency("Emergency Log")
// Panic and Fatal calls should be explanatory
l.Log("Log with context", fen.LogContext{"a": "b", "c": "d"})
fmt.Println(`
NewJSONLoggerWithOptions(fen.Options{fen.Debug, fen.Debug, "15:04:05.000", fen.Flat, fen.DefaultContextKey})
`)
l = fen.NewJSONLoggerWithOptions(fen.Options{fen.Debug, fen.Debug, "15:04:05.000", fen.Flat, fen.DefaultContextKey})
l.Println("Println")
l.Log("Log")
l.Debug("Debug Log")
l.Info("Info Log")
l.Notice("Notice Log")
l.Warning("Warning Log")
l.Error("Error Log")
l.Critical("Critical Log")
l.Alert("Alert Log")
l.Emergency("Emergency Log")
// Panic and Fatal calls should be explanatory
l.Log("Log with context", fen.LogContext{"a": "b", "c": "d"})
fmt.Println(`
NewJSONLoggerWithOptions(fen.Options{fen.Debug, fen.Debug, "15:04:05.000", fen.Nest, fen.DefaultContextKey})
`)
l = fen.NewJSONLoggerWithOptions(fen.Options{fen.Debug, fen.Debug, "15:04:05.000", fen.Nest, fen.DefaultContextKey})
l.Println("Println")
l.Log("Log")
l.Debug("Debug Log")
l.Info("Info Log")
l.Notice("Notice Log")
l.Warning("Warning Log")
l.Error("Error Log")
l.Critical("Critical Log")
l.Alert("Alert Log")
l.Emergency("Emergency Log")
// Panic and Fatal calls should be explanatory
l.Log("Log with context", fen.LogContext{"a": "b", "c": "d"})
fmt.Println(`
NewLoggerWithOptions(fen.Options{fen.Warning, fen.Debug, "15:04:05.000", fen.Prefix, fen.DefaultContextKey})
`)
l = fen.NewLoggerWithOptions(fen.Options{fen.Warning, fen.Debug, "15:04:05.000", fen.Prefix, fen.DefaultContextKey})
l.Println("Println")
l.Log("Log")
l.Debug("Debug Log")
l.Info("Info Log")
l.Notice("Notice Log")
l.Warning("Warning Log")
l.Error("Error Log")
l.Critical("Critical Log")
l.Alert("Alert Log")
l.Emergency("Emergency Log")
// Panic and Fatal calls should be explanatory
l.Log("Log with context", fen.LogContext{"a": "b", "c": "d"})
fmt.Println(`
NewJSONLoggerWithOptions(fen.Options{fen.Warning, fen.Debug, "15:04:05.000", fen.Prefix, fen.DefaultContextKey})
`)
l = fen.NewJSONLoggerWithOptions(fen.Options{fen.Warning, fen.Debug, "15:04:05.000", fen.Prefix, fen.DefaultContextKey})
l.Println("Println")
l.Log("Log")
l.Debug("Debug Log")
l.Info("Info Log")
l.Notice("Notice Log")
l.Warning("Warning Log")
l.Error("Error Log")
l.Critical("Critical Log")
l.Alert("Alert Log")
l.Emergency("Emergency Log")
// Panic and Fatal calls should be explanatory
l.Log("Log with context", fen.LogContext{"a": "b", "c": "d"})
}
package main
import (
"fmt"
fen "git.ondollo.com/fengaldar"
"net/http"
)
func main() {
fmt.Println(`
NewLogger
`)
l := fen.NewLogger()
func() {
l := l.Trace("given-trace-id")
l.Println("Should be the only line with traceid as given-trace-id")
}()
req, _ := http.NewRequest("", "", nil)
req.Header.Set("trace-id", "http-trace-id")
func() {
l := l.Trace(req.Header.Get("trace-id"))
l.Println("Should be the only line with traceid as http-trace-id")
}()
l.Println("Println")
l.Log("Log")
l.Debug("Debug Log")
l.Info("Info Log")
l.Notice("Notice Log")
l.Warning("Warning Log")
l.Error("Error Log")
l.Critical("Critical Log")
l.Alert("Alert Log")
l.Emergency("Emergency Log")
// Panic and Fatal calls should be explanatory
l.Log("Log with context", fen.LogContext{"a": "b", "c": "d"})
fmt.Println(`
NewLoggerWithOptions(fen.Options{fen.Debug, fen.Debug, "15:04:05.000", fen.Prefix, fen.DefaultContextKey})
`)
l = fen.NewLoggerWithOptions(fen.Options{fen.Debug, fen.Debug, "15:04:05.000", fen.Prefix, fen.DefaultContextKey})
l.Println("Println")
l.Log("Log")
l.Debug("Debug Log")
l.Info("Info Log")
l.Notice("Notice Log")
l.Warning("Warning Log")
l.Error("Error Log")
l.Critical("Critical Log")
l.Alert("Alert Log")
l.Emergency("Emergency Log")
// Panic and Fatal calls should be explanatory
l.Log("Log with context", fen.LogContext{"a": "b", "c": "d"})
fmt.Println(`
NewJSONLogger
`)
l = fen.NewJSONLogger()
func() {
l := l.Trace("given-trace-id")
l.Println("Should be the only line with traceid as given-trace-id")
}()
func() {
l := l.Trace(req.Header.Get("trace-id"))
l.Println("Should be the only line with traceid as http-trace-id")
}()
l.Println("Println")
l.Log("Log")
l.Debug("Debug Log")
l.Info("Info Log")
l.Notice("Notice Log")
l.Warning("Warning Log")
l.Error("Error Log")
l.Critical("Critical Log")
l.Alert("Alert Log")
l.Emergency("Emergency Log")
// Panic and Fatal calls should be explanatory
l.Log("Log with context", fen.LogContext{"a": "b", "c": "d"})
fmt.Println(`
NewJSONLoggerWithOptions(fen.Options{fen.Debug, fen.Debug, "15:04:05.000", fen.Prefix, fen.DefaultContextKey})
`)
l = fen.NewJSONLoggerWithOptions(fen.Options{fen.Debug, fen.Debug, "15:04:05.000", fen.Prefix, fen.DefaultContextKey})
l.Println("Println")
l.Log("Log")
l.Debug("Debug Log")
l.Info("Info Log")
l.Notice("Notice Log")
l.Warning("Warning Log")
l.Error("Error Log")
l.Critical("Critical Log")
l.Alert("Alert Log")
l.Emergency("Emergency Log")
// Panic and Fatal calls should be explanatory
l.Log("Log with context", fen.LogContext{"a": "b", "c": "d"})
fmt.Println(`
NewJSONLoggerWithOptions(fen.Options{fen.Debug, fen.Debug, "15:04:05.000", fen.Flat, fen.DefaultContextKey})
`)
l = fen.NewJSONLoggerWithOptions(fen.Options{fen.Debug, fen.Debug, "15:04:05.000", fen.Flat, fen.DefaultContextKey})
l.Println("Println")
l.Log("Log")
l.Debug("Debug Log")
l.Info("Info Log")
l.Notice("Notice Log")
l.Warning("Warning Log")
l.Error("Error Log")
l.Critical("Critical Log")
l.Alert("Alert Log")
l.Emergency("Emergency Log")
// Panic and Fatal calls should be explanatory
l.Log("Log with context", fen.LogContext{"a": "b", "c": "d"})
fmt.Println(`
NewJSONLoggerWithOptions(fen.Options{fen.Debug, fen.Debug, "15:04:05.000", fen.Nest, fen.DefaultContextKey})
`)
l = fen.NewJSONLoggerWithOptions(fen.Options{fen.Debug, fen.Debug, "15:04:05.000", fen.Nest, fen.DefaultContextKey})
l.Println("Println")
l.Log("Log")
l.Debug("Debug Log")
l.Info("Info Log")
l.Notice("Notice Log")
l.Warning("Warning Log")
l.Error("Error Log")
l.Critical("Critical Log")
l.Alert("Alert Log")
l.Emergency("Emergency Log")
// Panic and Fatal calls should be explanatory
l.Log("Log with context", fen.LogContext{"a": "b", "c": "d"})
fmt.Println(`
NewLoggerWithOptions(fen.Options{fen.Warning, fen.Debug, "15:04:05.000", fen.Prefix, fen.DefaultContextKey})
`)
l = fen.NewLoggerWithOptions(fen.Options{fen.Warning, fen.Debug, "15:04:05.000", fen.Prefix, fen.DefaultContextKey})
l.Println("Println")
l.Log("Log")
l.Debug("Debug Log")
l.Info("Info Log")
l.Notice("Notice Log")
l.Warning("Warning Log")
l.Error("Error Log")
l.Critical("Critical Log")
l.Alert("Alert Log")
l.Emergency("Emergency Log")
// Panic and Fatal calls should be explanatory
l.Log("Log with context", fen.LogContext{"a": "b", "c": "d"})
fmt.Println(`
NewJSONLoggerWithOptions(fen.Options{fen.Warning, fen.Debug, "15:04:05.000", fen.Prefix, fen.DefaultContextKey})
`)
l = fen.NewJSONLoggerWithOptions(fen.Options{fen.Warning, fen.Debug, "15:04:05.000", fen.Prefix, fen.DefaultContextKey})
l.Println("Println")
l.Log("Log")
l.Debug("Debug Log")
l.Info("Info Log")
l.Notice("Notice Log")
l.Warning("Warning Log")
l.Error("Error Log")
l.Critical("Critical Log")
l.Alert("Alert Log")
l.Emergency("Emergency Log")
// Panic and Fatal calls should be explanatory
l.Log("Log with context", fen.LogContext{"a": "b", "c": "d"})
}