https://github.com/bragdond/betalink-logger
A versatile and concurrent-safe logging library for Go
https://github.com/bragdond/betalink-logger
go logger syslog
Last synced: 3 months ago
JSON representation
A versatile and concurrent-safe logging library for Go
- Host: GitHub
- URL: https://github.com/bragdond/betalink-logger
- Owner: BragdonD
- License: cc0-1.0
- Created: 2025-01-06T13:05:49.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-01-30T19:28:16.000Z (4 months ago)
- Last Synced: 2025-01-30T20:28:43.112Z (4 months ago)
- Topics: go, logger, syslog
- Language: Go
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Betalink Logger
``Betalink-logger`` is the logger used in the different microservices of the betalink infrastructure. It provides customizable logging for applications. It supports multiple logging levels, file outputs, system logs, and concurrent-safe operations. The library is designed to be extensible and integrates seamlessly with both stdout and syslog.
## Features
- Multiple Log Levels:
- ``Info`` (INFO)
- ``Warning`` (WARN)
- ``Error`` (ERROR)
- ``Fatal`` (FATAL), which exits the program after logging.
- Custom Output Streams: Write logs to files, system log, stdout, or stderr.
- Concurrency-Safe Logging: Thread-safe operations with sync.Mutex.
- Configurable Logging Behavior: Enable or disable verbose logging for finer control.
- Graceful Closing: Ensures all log writers are properly closed to avoid data loss.## Installation
```shell
go get github.com/BragdonD/betalink-logger
```## Usage
```go
package mainimport (
"os""github.com/BragdonD/betalink-logger"
)func main() {
// Initialize logger with file output
logFile, _ := os.Create("app.log")
logger := betalinklogger.NewLogger("MyApp", true, false, logFile)defer logger.Close()
// Log messages with different severity levels
logger.Info("This is an informational message.")
logger.Warning("This is a warning.")
logger.Error("This is an error.")
}
```## Contributing
Feel free to open issues or submit pull requests for enhancements or bug fixes.
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.