Keep Logging in the ActiveModelSerializers namespace

This commit is contained in:
Benjamin Fleischer
2015-11-08 15:46:08 -06:00
parent 51424963da
commit 21bb306d38
9 changed files with 66 additions and 60 deletions

View File

@@ -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
}
```

View File

@@ -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)
```