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

customlogger

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

customlogger

  • 0.0.9
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Custom Logger

Gem Version Build Status

Custom logger allows you to log you're debug information to an html file so you can view them in much more easier way. All you need to do is include the gem in the Gemfile and then use it directly CustomLogger.

Compatable

CustomLogger is compatible with Ruby 1.9 and above. As for Rails 3.x and up. You should not be using or have Ruby 1.8 installed for obvious reasons.

Installation

Add this line to your application's Gemfile:

group :development, :test do
  [...]
  gem 'customlogger'
  [...]
end

Keep in mind that "[...]" means that there may or may not be other gems there.

And then execute:

$ bundle

Or install it yourself as:

$ gem install customlogger

Usage

Custom Logger is very easy to use. Just use the module 'CustomLogger' anywhere and log the message in a nice friendly colorful html page view. All the logging follows pattern of message input first followed by optional title. Take a look at the examples below.

Example Screenshot

Log error
CustomLogger.error 'This is an error message'
CustomLogger.error('This is an error message', 'Error Title')

Error Screenshot

Log warning
CustomLogger.warning 'This is a warning message'
CustomLogger.warning('This is a warning message', 'Warning Title')

Warning Screenshot

Log debug
CustomLogger.debug 'This is a debug message'
CustomLogger.debug('This is a debug message', 'Debug Title')

Debug Screenshot

Log info
CustomLogger.info 'This is an info message'
CustomLogger.info('This is an info message', 'Info Title')

Info Screenshot

Log raw

Keep in mind that raw means that no formatting is applied so if the output is 1000 characters horizontal without any line break then that is what you will see. Basically it is inside of a 'pre' html tag.

CustomLogger.raw 'This is a raw message'
CustomLogger.raw('This is a raw message', 'Raw Title')

Raw Screenshot

ActiveRecord Support

CustomLogger supports ActiveRecord if you use ActiveRecord. To log ActiveRecord just use raw logger. For an example:

CustomLogger.raw(User.first, 'This is User.first')

ActiveRecord Log

New Line

If you want to add a gap in-between sets of outputs then this is what you are looking for.

CustomLogger.new_line

New Line

Clear All Logs

To clear all logs that are there in the html file

CustomLogger.clear

To auto clear all logs on EACH log

CustomLogger.auto_clear = true

To disable auto clear all logs on EACH log (default)

CustomLogger.auto_clear = true

Log File

You will find the log file in:

log/custom_logger.html

Running Test On Gem (Not Rails App)

bundle exec rake spec

Contributing

  1. Fork it ( https://github.com/SaimonL/CustomLogger/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

FAQs

Package last updated on 12 Dec 2014

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