Table of Contents
-
About The Project
-
Getting Started
- Usage
- Roadmap
- Contributing
- License
- Contact
- Acknowledgments
About The Project
This project was made to address the need for myself in having a colourful, standardised output similar to LoggerInterface
solutions available in other languages.
In short, this module is a wrapper on top of the standard library Log
to output formatted logs to the terminal for a given service in the following format:
(back to top)
Built With
(back to top)
Getting Started
Prerequisites
It is assumed that you already have Go installed on your machine.
Installation
- Import the module to your project.
go get github.com/jamestkelly/go-logger-interface
(back to top)
Usage
To utilise the package after installing the module, simply create a logger interface at the top of your given file and use it like so:
// example.go
import (
github.com/jamestkelly/go-logger-interface
)
var (
exampleLogger = logger.LoggerInterface{Prefix: "ExampleLoggerInterface"}
)
// main
// Example main function to log a bunch of statements using LoggerInterface
func main() {
exampleLogger.LogMessage(
"This is a 'DEBUG' message.",
"DEBUG",
)
exampleLogger.LogMessage(
"This is an 'INFO' message.",
"INFO",
)
exampleLogger.LogMessage(
fmt.Sprintf("This is a %s 'INFO' message.", "formatted"),
"INFO",
)
exampleLogger.LogMessage(
"This is a 'WARN' message.",
"WARN",
)
exampleLogger.LogMessage(
"This is an 'ERROR' message.",
"ERROR",
)
exampleLogger.LogMessage(
"This is a 'FATAL' message.",
"FATAL",
)
}
For more examples, please refer to the Examples
(back to top)
Roadmap
- Create the package and make it available publically.
See the open issues for a full list of proposed features (and known issues).
(back to top)
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
)
- Commit your Changes (
git commit -m 'Add some AmazingFeature'
)
- Push to the Branch (
git push origin feature/AmazingFeature
)
- Open a Pull Request
(back to top)
License
Distributed under the MIT License. See LICENSE.txt
for more information.
(back to top)
Jim Kelly - jimkelly.t@outlook.com
Project Link: https://github.com/jamestkelly/go-logger-interface
(back to top)
Acknowledgments
(back to top)