From 17a651c3ffa7992d956ff27cb7ed35c2a21ce157 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Thu, 23 Feb 2023 11:17:06 -0500 Subject: [PATCH] docs: use picture tags https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#specifying-the-theme-an-image-is-shown-to --- README.md | 85 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 59 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index f4ff844..34ccb3a 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,24 @@ # Log

- - -
- Latest Release - Go Docs - Build Status + + + + + +
+ Latest Release + Go Docs + Build Status

A minimal and colorful Go logging library. 🪵 -Made with VHS -Made with VHS + + + + Made with VHS + It provides a leveled structured human readable logger with a small API. Unlike [standard `log`][stdlog], the Charm logger provides customizable colorful human @@ -49,8 +55,11 @@ log.Debug("Cookie 🍪") // won't print anything log.Info("Hello World!") ``` -Made with VHS -Made with VHS + + + + Made with VHS + All logging levels accept optional key/value pairs to be printed along with a message. @@ -60,8 +69,11 @@ err := fmt.Errorf("too much sugar") log.Error("failed to bake cookies", "err", err) ``` -Made with VHS -Made with VHS + + + + Made with VHS + You can use `log.Print()` to print messages without a level prefix. @@ -81,8 +93,11 @@ if butter { } ``` -Made with VHS -Made with VHS + + + + + ### Levels @@ -134,8 +149,11 @@ time.Sleep(10 * time.Minute) logger.Info("Finished baking") ``` -Made with VHS -Made with VHS + + + + + Use `log.SetFormatter()` or `log.WithFormatter()` to change the output format. Available options are: @@ -177,8 +195,11 @@ log.KeyStyles["err"] = lipgloss.NewStyle().Foreground(lipgloss.Color("204")) log.Error("Whoops!", "err", "kitchen on fire") ``` -Made with VHS -Made with VHS + + + + + ### Sub-logger @@ -190,8 +211,11 @@ batch2.Debug("Preparing batch 2...") batch2.Debug("Adding chocolate chips") ``` -Made with VHS -Made with VHS + + + + + ### Format Messages @@ -203,8 +227,11 @@ for item := 1; i <= 100; i++ { } ``` -Made with VHS -Made with VHS + + + + + Or arguments: @@ -214,8 +241,11 @@ for temp := 375; temp <= 400; temp++ { } ``` -Made with VHS -Made with VHS + + + + + ### Helper Functions @@ -232,8 +262,11 @@ log.SetReportCaller(true) startOven(400) // INFO Starting oven degree=400 ``` -Made with VHS -Made with VHS + + + + + This will use the _caller_ function (`startOven`) line number instead of the logging function (`log.Info`) to report the source location.