mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Keep Logging in the ActiveModelSerializers namespace
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
# Instrumentation
|
||||
|
||||
AMS uses the instrumentation API provided by Active Support this way we
|
||||
can choose to be notified when AMS events occur inside our application.
|
||||
ActiveModelSerializers uses the ActiveSupport::Notification API, which
|
||||
allows for subscribing to events, such as for logging.
|
||||
|
||||
## render.active_model_serializers
|
||||
## Events
|
||||
|
||||
|key | value |
|
||||
|-------------|----------------------|
|
||||
|:serializer | The serializer class |
|
||||
|:adapter | The adapter instance |
|
||||
Name:
|
||||
|
||||
`render.active_model_serializers`
|
||||
|
||||
Payload (example):
|
||||
|
||||
```ruby
|
||||
{
|
||||
serializer: PostSerializer,
|
||||
adapter: #<ActiveModel::Serializer::Adapter::Attributes:0x007f96e81eb730>
|
||||
adapter: ActiveModel::Serializer::Adapter::Attributes
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Logging
|
||||
|
||||
If we are using AMS on Rails app by default the `Rails.logger` will be used.
|
||||
If we are using ActiveModel::Serializers on Rails app by default the `Rails.logger` will be used.
|
||||
|
||||
On a non Rails enviroment by default the `ActiveSupport::TaggedLogging` will be
|
||||
used.
|
||||
@@ -8,5 +8,5 @@ used.
|
||||
If we need to customize the logger we can define this in an initializer:
|
||||
|
||||
```ruby
|
||||
ActiveModel::Serializer.logger = Logger.new(STDOUT)
|
||||
ActiveModelSerializers.logger = Logger.new(STDOUT)
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user