Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/igorkasyanchuk/active_storage_silent_logs
The idea of this gem is to hide as much as possible Active Storage logs from console so you can see only important information and requests
https://github.com/igorkasyanchuk/active_storage_silent_logs
active-storage activestorage logging rails5 upload
Last synced: 12 days ago
JSON representation
The idea of this gem is to hide as much as possible Active Storage logs from console so you can see only important information and requests
- Host: GitHub
- URL: https://github.com/igorkasyanchuk/active_storage_silent_logs
- Owner: igorkasyanchuk
- License: mit
- Created: 2018-08-29T14:48:07.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-09-12T07:39:27.000Z (over 2 years ago)
- Last Synced: 2025-01-12T19:21:24.930Z (21 days ago)
- Topics: active-storage, activestorage, logging, rails5, upload
- Language: Ruby
- Homepage:
- Size: 68.4 KB
- Stars: 13
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
# Active Storage silent logger
The idea of this gem is to hide as much as possible Active Storage logs from console so you can see only important information and requests. So ...
Do you like logs like:
```log
Started GET "/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJaDExUkhSelFuaHpNbVJyV1dsNFVsaGpaMXBTYVV0YWNGUUdPZ1pGVkE9PSIsImV4cCI6IjIwMTgtMDgtMjlUMTQ6MzA6MjAuMjE3WiIsInB1ciI6ImJsb2Jfa2V5In19--96a1e9bc562decfc1b9c22ebde2e57029ed5ea20/image.png?content_type=image%2Fpng&disposition=inline%3B+filename%3D%22image.png%22%3B+filename%2A%3DUTF-8%27%27image.png" for 192.168.223.1 at 2018-08-29 10:25:48 -0400
Processing by ActiveStorage::DiskController#show as PNG
Parameters: {"content_type"=>"image/png", "disposition"=>"inline; filename=\"image.png\"; filename*=UTF-8''image.png", "encoded_key"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJaDExUkhSelFuaHpNbVJyV1dsNFVsaGpaMXBTYVV0YWNGUUdPZ1pGVkE9PSIsImV4cCI6IjIwMTgtMDgtMjlUMTQ6MzA6MjAuMjE3WiIsInB1ciI6ImJsb2Jfa2V5In19--96a1e9bc562decfc1b9c22ebde2e57029ed5ea20", "filename"=>"image"}
```What we don't like in console it looks like:
[![Sample](https://raw.githubusercontent.com/igorkasyanchuk/active_storage_silent_logs/master/docs/log.png)](https://raw.githubusercontent.com/igorkasyanchuk/active_storage_silent_logs/master/docs/log.png)
So do you like it? I think no. It looks like a garbage.
Imagine you have 1000 images to show! How long you need to scroll to see log of main request?
So if you want this gem can hide such logs for you. Very useful for development.
**Since Rails logger is not thread-safe this gem doesn't fix all messages, since one thread could impact another. If you want to hide - run puma with only one thread (open `puma.rb` and put `threads_count = ENV.fetch("RAILS_MAX_THREADS") { 1 }`).**
## Usage
Just add gem into `Gemfile` in Rails app.
## Installation
```ruby
gem 'active_storage_silent_logs', group: :development
```And then execute:
```bash
$ bundle
```## TODO
* verify with other storages (s3 and other cloud services)
* can we disable puma logger?
* is it possible to fix issue with thread-safe with logger?## Contributing
You are welcome to contribute and help with testing.
To play with gem open `test/dummy` and run `rake db:migrate` + `rails s -b 0.0.0.0 puma`.
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).[](https://www.railsjazz.com/?utm_source=github&utm_medium=bottom&utm_campaign=active_storage_silent_logs)