diff --git a/README.md b/README.md index 060b0b3..32d0e72 100644 --- a/README.md +++ b/README.md @@ -21,4 +21,36 @@ all methods of zap: ## example -you can find example in [examples](./examples). \ No newline at end of file +you can find example in [examples](./examples). + +```go +// cat ./examples/default/main.go +package main + +import "github.com/chalvern/sugar" + +func main() { + + sugar.Debug("default development sugar of chalvern") + myCustomLogger() + myCustomLogger2() + + sugar.InitProductionSugar() + sugar.Debug("should not be printed") + sugar.Info("default production sugar of chalvern") + myCustomLogger() + myCustomLogger2() +} + +func myCustomLogger() { + myLogger := sugar.NewLoggerOf("my_custom_logger") + myLogger.Info("log of myCustomLogger info") + myLogger.Warn("log of myCustomLogger warn") +} + +func myCustomLogger2() { + myLogger := sugar.NewLoggerOf("my_custom_logger_2") + myLogger.Info("log of myCustomLogger2 info") + myLogger.Warn("log of myCustomLogger2 warn") +} +``` \ No newline at end of file