Skip to content

emboss/diff_logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An ActiveSupport::Concern that allows to log the changes made in an update. By default, it will log the changes to the console using the Rails.logger, but it is also possible to use custom functionality.

Using the default

require 'diff_logger'

class Post < ActiveRecord::Base
  include DiffLogger

  ...

end

This will now log (at :info level) the changes made during an update to the Rails console.

Using a custom logger

require 'diff_logger'

class Post < ActiveRecord::Base
  include DiffLogger.custom { |changes| puts "Custom: #{changes.inspect}" }

  ...

end

The block to DiffLogger::custom takes the changes as its argument, which is a Hash containing the changed properties - cf. the docs for more information.

License

Copyright (c) 2013 Martin Boßlet. Distributed under the MIT License. See LICENSE for further details.

About

Allows to log changes made in an update, either by default logging or by providing a custom logger.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages