From c44d147b9c36f87ccc0576cb47284d133d76d89b Mon Sep 17 00:00:00 2001 From: nxshock Date: Thu, 12 May 2022 19:24:27 +0500 Subject: [PATCH] Fix README example format --- README.md | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 70990b9..73283b6 100644 --- a/README.md +++ b/README.md @@ -7,30 +7,30 @@ Provides time prefix generation for each line of provided messages. ## Usage example ```go - import "github.com/nxshock/logwriter" +import "github.com/nxshock/logwriter" - // Create new writer that writes result to stdout - writer := logwriter.New(os.Stdout) +// Create new writer that writes result to stdout +writer := logwriter.New(os.Stdout) - // Set custom time format and timezone if needed - writer.TimeFormat = "02.01.06 15:04:05" - writer.TimeZone = time.UTC +// Set custom time format and timezone if needed +writer.TimeFormat = "02.01.06 15:04:05" +writer.TimeZone = time.UTC - writer.Print("hello world") - // result: - // 02.01.06 15:04:05 hello world +writer.Print("hello world") +// result: +// 02.01.06 15:04:05 hello world - writer.Write([]byte("line 1\nline 2\nline 3")) - // result: - // 02.01.06 15:04:05 line 1 - // 02.01.06 15:04:05 line 2 - // 02.01.06 15:04:05 line 3 +writer.Write([]byte("line 1\nline 2\nline 3")) +// result: +// 02.01.06 15:04:05 line 1 +// 02.01.06 15:04:05 line 2 +// 02.01.06 15:04:05 line 3 - writer.Print("hello ") - writer.Print("world") - // result: - // 02.01.06 15:04:05 hello world +writer.Print("hello ") +writer.Print("world") +// result: +// 02.01.06 15:04:05 hello world - writer.Close() - // writes final \n if not written before +writer.Close() +// writes final \n if not written before ```