From 8c7814d86bb77455529ba0c3c6ba2095da276510 Mon Sep 17 00:00:00 2001 From: Avdushin Date: Thu, 21 Dec 2023 03:43:27 +0300 Subject: [PATCH] v1.0.2 Added godocs Updated License --- Examples/App_example/main.go | 12 ++++++++++++ Examples/App_example/utils/helper.go | 3 +++ Examples/App_example/utils/logger.go | 3 +++ Examples/App_example/utils/utils_test.go | 24 ++++++++++++++++++++++++ Examples/logfile/logfile.go | 14 ++++++++++++++ LICENSE | 10 +++++----- README.md | 7 +++++++ gogger/Version.go | 3 +-- lib/Writer.go | 1 + lib/logger.go | 1 + logger/InitLogger.go | 1 + logger/logger.go | 1 + 12 files changed, 73 insertions(+), 7 deletions(-) create mode 100644 Examples/App_example/utils/utils_test.go diff --git a/Examples/App_example/main.go b/Examples/App_example/main.go index 0278e09..d444cff 100644 --- a/Examples/App_example/main.go +++ b/Examples/App_example/main.go @@ -5,7 +5,19 @@ import ( ) func main() { + // Init logger log := utils.Logger() + // Print Debug log log.Debug("Test message") + // Call Helper function from utils utils.Helper("Emenem") + + // Output: + // 2023/12/21 03:19:03 [INFO] Пример лога уровня INFO + // 2023/12/21 03:19:03 [DEBUG] Пример лога уровня DEBUG + // 2023/12/21 03:19:03 [WARNING] Пример лога уровня WARNING + // 2023/12/21 03:19:03 [ERROR] Пример лога уровня ERROR + // 2023/12/21 03:19:03 [INFO] Just Print INFO message + // 2023/12/21 03:19:03 [DEBUG] Test message + // 2023/12/21 03:19:03 [WARNING] Emenem } diff --git a/Examples/App_example/utils/helper.go b/Examples/App_example/utils/helper.go index 185b435..a61f166 100644 --- a/Examples/App_example/utils/helper.go +++ b/Examples/App_example/utils/helper.go @@ -1,3 +1,6 @@ +// Tis package contains the utility functions +// Helper - a function that printing a Warnings message +// logger - a function that setups the logger package utils import "github.com/Avdushin/gogger/logger" diff --git a/Examples/App_example/utils/logger.go b/Examples/App_example/utils/logger.go index f0ad91f..b33acc9 100644 --- a/Examples/App_example/utils/logger.go +++ b/Examples/App_example/utils/logger.go @@ -1,3 +1,6 @@ +// Tis package contains the utility functions +// Helper - a function that printing a Warnings message +// logger - a function that setups the logger package utils import ( diff --git a/Examples/App_example/utils/utils_test.go b/Examples/App_example/utils/utils_test.go new file mode 100644 index 0000000..4e32dac --- /dev/null +++ b/Examples/App_example/utils/utils_test.go @@ -0,0 +1,24 @@ +package utils_test + +import ( + "github.com/Avdushin/gogger/Examples/App_example/utils" +) + +func ExampleHelper() { + utils.Helper("emenem") + + // Output: + // 2023/12/21 03:19:03 [WARNING] Emenem +} + +func ExampleLoggger() { + utils.Logger() + + // Output: + // 2023/12/21 03:28:42 [INFO] Пример лога уровня INFO + // 2023/12/21 03:28:42 [DEBUG] Пример лога уровня DEBUG + // 2023/12/21 03:28:42 [WARNING] Пример лога уровня WARNING + // 2023/12/21 03:28:42 [ERROR] Пример лога уровня ERROR + // 2023/12/21 03:28:42 [INFO] Just Print INFO message + // 2023/12/21 03:28:42 [DEBUG] Test message +} diff --git a/Examples/logfile/logfile.go b/Examples/logfile/logfile.go index 605007b..3290c76 100644 --- a/Examples/logfile/logfile.go +++ b/Examples/logfile/logfile.go @@ -12,4 +12,18 @@ func main() { log.Warning("Пример лога уровня WARNING") log.Error("Пример лога уровня ERROR") log.Print("Just Print INFO message") + + // Output: + // 2023/12/21 03:08:59 [INFO] Пример лога уровня INFO + // 2023/12/21 03:08:59 [DEBUG] Пример лога уровня DEBUG + // 2023/12/21 03:08:59 [WARNING] Пример лога уровня WARNING + // 2023/12/21 03:08:59 [ERROR] Пример лога уровня ERROR + // 2023/12/21 03:08:59 [INFO] Just Print INFO message + // + // Files Tree: + // . + // ├── dayly_logs.go + // └── logs + // └── logs.log + } diff --git a/LICENSE b/LICENSE index 96e85a6..24fb2b7 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -MIT License +The MIT License (MIT) Copyright (c) 2023 Avdushin @@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 4153c76..7b32482 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,13 @@ go get -u github.com/Avdushin/gogger/logger go get -u github.com/Avdushin/gogger/lib ``` +## Documentation + +```bash +go install golang.org/x/tools/cmd/godoc@latest +godoc -http :8080 +``` + ## Examples ### Init logger diff --git a/gogger/Version.go b/gogger/Version.go index 1c9ea22..32bc24e 100644 --- a/gogger/Version.go +++ b/gogger/Version.go @@ -1,8 +1,7 @@ // Copyright 2023 Gogger Core Team. All rights reserved. // Use of this source code is governed by a MIT style // license that can be found in the LICENSE file. - package gogger // Version is the current gogger logger version. -const Version = "v1.0.1" +const Version = "v1.0.2" diff --git a/lib/Writer.go b/lib/Writer.go index 7464dd7..a90b768 100644 --- a/lib/Writer.go +++ b/lib/Writer.go @@ -1,5 +1,6 @@ package lib +// This is a writer function func (l *Logger) Write(p []byte) (n int, err error) { l.mu.Lock() defer l.mu.Unlock() diff --git a/lib/logger.go b/lib/logger.go index d01042e..ed73c68 100644 --- a/lib/logger.go +++ b/lib/logger.go @@ -1,3 +1,4 @@ +// The lib package contains core functionality of the Gogger package lib import ( diff --git a/logger/InitLogger.go b/logger/InitLogger.go index e8fe695..cc6cb39 100644 --- a/logger/InitLogger.go +++ b/logger/InitLogger.go @@ -1,3 +1,4 @@ +// The logger package contains the implementation of core logging methods package logger import ( diff --git a/logger/logger.go b/logger/logger.go index 339b316..6a95314 100644 --- a/logger/logger.go +++ b/logger/logger.go @@ -1,3 +1,4 @@ +// The logger package contains the implementation of core logging methods package logger import "github.com/Avdushin/gogger/lib"