```ruby
# Interceptor in lib/disable_email_interceptor.rb
ActionMailer::Base.register_interceptor(DisableEmailInterceptor) unless Gitlab.config.gitlab.email_enabled
```

Disable the action mailer base logging when emails are disabled
user
```ruby
# Interceptor in lib/disable_email_interceptor.rb
unless Gitlab.config.gitlab.email_enabled
  ActionMailer::Base.register_interceptor(DisableEmailInterceptor)
  ActionMailer::Base.logger = nil
end
```
assistant