Skip to content

Instantly share code, notes, and snippets.

@baweaver
Last active August 29, 2015 14:15
Show Gist options
  • Save baweaver/3176d6cd6bd7b948f318 to your computer and use it in GitHub Desktop.
Save baweaver/3176d6cd6bd7b948f318 to your computer and use it in GitHub Desktop.
A way to inline a logger on any statement
module Rails
def self.log_fn(level)
-> object { self.logger.public_send(level, object); object }
end
end
1.tap(&Rails.log_fn(:info))
# 1
# => 1
@rebekah
Copy link

rebekah commented Feb 19, 2015

hmmm, fun with Rails :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment