https://github.com/dhyanio/gogger
Golang + Logger is a simple and efficient logging library for Go
https://github.com/dhyanio/gogger
golang log logger logging
Last synced: 10 months ago
JSON representation
Golang + Logger is a simple and efficient logging library for Go
- Host: GitHub
- URL: https://github.com/dhyanio/gogger
- Owner: dhyanio
- License: apache-2.0
- Created: 2024-11-22T06:54:10.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-24T08:06:43.000Z (over 1 year ago)
- Last Synced: 2025-02-01T19:11:26.476Z (over 1 year ago)
- Topics: golang, log, logger, logging
- Language: Go
- Homepage:
- Size: 12.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Gogger
Golang + Logger is a simple and efficient logging library for Go (Golang) that provides easy-to-use logging functionalities.
## Features
- Simple API for logging at different levels (Info, Warning, Error, Debug)
- Customizable log format
- Support for logging to different outputs (console, file, etc.)
- Lightweight and efficient
## Installation
To install Gogger, use `go get`:
```sh
go get github.com/dhyanio/gogger
```
## Usage
Here's a basic example of how to use Gogger:
```go
package main
import (
"github.com/dhyanio/gogger"
)
func main() {
log, err := gogger.NewLogger("logfile.log", gogger.INFO)
if err != nil {
panic(err)
}
log.Info().Str("TaskType", "mytask").Int("EventCount", len(numberOfEvens)).Msg("This is an info message")
log.Warning.Str("TaskType", "mytask").Int("EventCount", len(numberOfEvens)).Msg("This is an warning message")
log.Error.Str("TaskType", "mytask").Int("EventCount", len(numberOfEvens)).Msg("This is an error message")
log.Debug.Str("TaskType", "mytask").Int("EventCount", len(numberOfEvens)).Msg("This is an debug message")
}
```
## Configuration
You can customize the logger by setting different options in the configuration file:
```go
func main() {
config := gogger.Config{
Output: "stdout",
Format: "json",
Level: gogger.INFO,
}
log, err := gogger.NewLoggerWithConfig(config)
if err != nil {
panic(err)
}
}
```
## Contributing
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
## Acknowledgements
Thanks to the Go community for their support and contributions. ❤️