Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/teodev1611/batman
A simple and super power logger
https://github.com/teodev1611/batman
golang golang-library golang-package log logger logging logging-library
Last synced: 4 months ago
JSON representation
A simple and super power logger
- Host: GitHub
- URL: https://github.com/teodev1611/batman
- Owner: TeoDev1611
- License: apache-2.0
- Created: 2021-12-20T01:56:43.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-13T11:02:02.000Z (almost 2 years ago)
- Last Synced: 2024-06-20T05:03:39.293Z (8 months ago)
- Topics: golang, golang-library, golang-package, log, logger, logging, logging-library
- Language: Go
- Homepage:
- Size: 263 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![]()
The most powerfull and faster logger for golang powered by DC
![]()
![]()
![]()
# :thinking: What is this?
Well this is a simple logger created with some tools and colors :sunglasses:
## :eyes: How see this in action ?
- Terminal color action
![Terminal Usage](./docs/terminal_image.png)
- Log file generator
![Log File generator](./docs/log_image.png)
# :keyboard: How install this ?
```
go get -u github.com/TeoDev1611/batman/log
```# :ok_hand: Examples
```go
package mainimport (
"github.com/TeoDev1611/batman/log" // Import the log library
)func main() {
log.Config.AppName = "YourAppName" // Add the app name for the folder to create the logs
log.Config.FileToLog = "filetolog.log" // Add the name for the file to write the logs ( JSON FORMAT )
err := log.Init() // Init the app
if err != nil {
panic(err) // Check the errors
}
log.Info("an example info") // Make a info level logger
log.Warning("an example warning") // Make a warning logger
log.Error("an example error") // Make a error logger
log.Fatal("an example fatal") // Make a fatal
print("this will be not printed") // WHY THIS NOT PRINT ( Make a os exit status 2 for the fatal)
// DISABLE ?? Check the customization opts
}
```- Customization examples
```go
package mainimport (
"github.com/TeoDev1611/batman/log" // Import the log library
)func init(){
log.LogOpts.Error = "CUSTOM_KEY_ERROR" // Custom the key for the log file in the error level DEFAULT: ERROR
log.LogOpts.Info = "CUSTOM_KEY_INFO" // Custom the key for the log file in the info level DEFAULT: INFO
log.LogOpts.Warning = "CUSTOM_KEY_WARN" // Custom the key for the log file in the warn level DEFAULT: WARN
log.LogOpts.Fatal = "CUSTOM_KEY_FATAL" // Custom the key for the log file in the fatal level DEFAULT: FATALlog.LogOpts.ErrorExit = true // Exit the program with 2 code in the error logs DEFAULT: false
log.LogOpts.FatalExit = true // Exit the program with 2 code in the fatal logs DEFAULT: true
}
```# :books: Steps to contribute
1. Make a Fork to this repository
2. Make a branch with the feature to add
3. Use the conventional commits guide [more information here](https://www.conventionalcommits.org/en/v1.0.0/)
4. Make a pull request with a explanation what you changes or features
5. Review your pull request :shipit:
6. Merge the pull request or request changes
7. Done! :smiley:# :mega: Credits
Special thanks to [Ashley Willis](https://twitter.com/ashleymcnamara) were i stracted the gopher batman image [here](https://twitter.com/ashleymcnamara/status/879796984491540480/photo/2)
---
Made with :heart: in Ecuador