Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

log_me

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

log_me

  • 1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= LogMe

Adds custom logging functionality to controllers and models in a Rails application.

== Installation

Add the gem to your gemfile

gem 'log_me'

== Example usage

class Post < ActiveRecord::Base
  log_me  # turn on the logging functionality for this class

  def an_instance_method
    # ... do something ...
    log "This is a logging message with severity info"
    log "This is a logging message with severity error", :error
  end
  
  def self.a_class_method
    # since logging is done on class level
    # this isn't a problem
    log "This is a logging message in a class method, as warning", :warning
  end
end

The standard behaviour cares about the naming of the logfile. In the example above the logfile can be found under YourApplication/log/post.log

To alter this behaviour just provide an own name, like so:

class Post < ActiveRecord::Base
    log_me "my_own_logfile_name"

    # ...
end

In this style the logfile can be found under YourApplication/log/my_own_logfile_name.log

== Additions

The logging functionality is added to ActiveRecord::Base and ActionController::Base. So each class that inherits from either of them is able to use the logging functionality.

== Authors and credits

Author:: Robert Neumayr Original idea:: http://www.tonyamoyal.com/2009/09/24/specific-logging-for-your-rails-models-the-easy-way/

FAQs

Package last updated on 13 Jun 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc