Socket
Book a DemoInstallSign in
Socket

color_debug_messages

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

color_debug_messages

1.1.3
bundlerRubygems
Version published
Maintainers
1
Created
Source

= NAME

Color Debug Messages - A way to add nicer output to your script.

= DESCRIPTION

I got tired of plain output on STDOUT, and wanted a nicer way to add debug/informational messages to my scripts. This works with the idea that it is easier for our eyes to notice changes in color than changes in glyph/shape. A red error message is notices more easily than a "*****" prefix or similar.

To get this effect, we rely on Term::ANSIColor

== Install

gem install color_debug_messages

== Usage

The basic use of this script is very simple - you just include the module into your class, and call the various "puts" wrappers.

class Foo
  include ColorDebugMessages
  def bar(baz)
    debug "This is a debug message!"
  end
end

Which produces:

[Foo#bar] >>> This is a debug message!

The part in square-brackets at the beginning will be in read, which I unfortunately am having a hard time making RDoc produce.

The available message types, by default, are:

debug(msg)  # ">>>" prefix, in cyan
warn(msg)   # "**>" prefix, in red
info(msg)   # "-->" prefix, in green

These can be changed by adding lines like this to the top of your class:

class Foo
  include ColorDebugMessages
  color_debug_message_type :quux, '~', :blue

  def bar
    quux "Test message!"
  end
end

Which will produce yellow output, with the "~~>" prefix instead.

= COPYRIGHT

Copyright (c) 2010 Brent Sanders. See LICENSE for details.

FAQs

Package last updated on 03 Jan 2010

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.