https://github.com/bitquery/bitquery_logger
Logger
https://github.com/bitquery/bitquery_logger
Last synced: 5 months ago
JSON representation
Logger
- Host: GitHub
- URL: https://github.com/bitquery/bitquery_logger
- Owner: bitquery
- License: mit
- Created: 2021-09-08T17:22:57.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-10-04T10:01:32.000Z (over 2 years ago)
- Last Synced: 2025-05-30T02:44:36.182Z (8 months ago)
- Language: Ruby
- Size: 41 KB
- Stars: 0
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# BitqueryLogger
## Installation
Add this line to your application's Gemfile:
```ruby
# Logger
gem 'bitquery_logger', git: 'https://github.com/bitquery/bitquery_logger.git', branch: 'main'#, path: '../bitquery_logger'
```
And then execute:
$ bundle install
Execute
$ rails g bitquery_logger:install
to add initializer
And add to `environments/[env].rb`
```ruby
BITQUERY_LOGGER_CONFIG = {
output: :file,
log_level: 0
}
```
Possible settings
```ruby
BITQUERY_LOGGER_CONFIG = {
# Uncomment to 'disable' logger
# output: :stdout,
# format_stdout: false,
output: :tcp,
host: "127.0.0.1",
port: 5170,
buffer_max_items: 300,
log_level: 2,
# output: :stdout # :stdout_json, :file
# stdout_log_level: 0,
# 0 - debug, 1 - info, 2 - warn, 3 - error
# format_stdout: true
}
```
## Usage
Automatic exception dispatch already works
To send message with some level use
```ruby
BitqueryLogger.debug msg
BitqueryLogger.info msg
BitqueryLogger.warn msg
BitqueryLogger.error msg
```
`msg` can be String or Hash
To add to context use:
```ruby
BitqueryLogger.extra_context hash
```
To flush buffer use:
```ruby
BitqueryLogger.flush
```
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bitquery_logger. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/bitquery_logger/blob/main/CODE_OF_CONDUCT.md).
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
## Code of Conduct
Everyone interacting in the BitqueryLogger project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/bitquery_logger/blob/main/CODE_OF_CONDUCT.md).