| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>README - Logger -- Ruby Standard Logger</title> | |
| <script type="text/javascript"> | |
| var rdoc_rel_prefix = "./"; | |
| var index_rel_prefix = "./"; | |
| </script> | |
| <script src="./js/jquery.js"></script> | |
| <script src="./js/darkfish.js"></script> | |
| <link href="./css/fonts.css" rel="stylesheet"> | |
| <link href="./css/rdoc.css" rel="stylesheet"> | |
| <body id="top" role="document" class="file"> | |
| <nav role="navigation"> | |
| <div id="project-navigation"> | |
| <div id="home-section" role="region" title="Quick navigation" class="nav-section"> | |
| <h2> | |
| <a href="./index.html" rel="home">Home</a> | |
| </h2> | |
| <div id="table-of-contents-navigation"> | |
| <a href="./table_of_contents.html#pages">Pages</a> | |
| <a href="./table_of_contents.html#classes">Classes</a> | |
| <a href="./table_of_contents.html#methods">Methods</a> | |
| </div> | |
| </div> | |
| <div id="search-section" role="search" class="project-section initially-hidden"> | |
| <form action="#" method="get" accept-charset="utf-8"> | |
| <div id="search-field-wrapper"> | |
| <input id="search-field" role="combobox" aria-label="Search" | |
| aria-autocomplete="list" aria-controls="search-results" | |
| type="text" name="search" placeholder="Search" spellcheck="false" | |
| title="Type to search, Up and Down to navigate, Enter to load"> | |
| </div> | |
| <ul id="search-results" aria-label="Search Results" | |
| aria-busy="false" aria-expanded="false" | |
| aria-atomic="false" class="initially-hidden"></ul> | |
| </form> | |
| </div> | |
| </div> | |
| <div class="nav-section"> | |
| <h3>Table of Contents</h3> | |
| <ul class="link-list" role="directory"> | |
| <li><a href="#label-Logger">Logger</a> | |
| <li><a href="#label-Installation">Installation</a> | |
| <li><a href="#label-Usage">Usage</a> | |
| <li><a href="#label-Simple+Example">Simple Example</a> | |
| <li><a href="#label-Development">Development</a> | |
| <li><a href="#label-Advanced+Development">Advanced Development</a> | |
| <li><a href="#label-Run+tests+of+a+specific+file">Run tests of a specific file</a> | |
| <li><a href="#label-Run+tests+filtering+test+methods+by+a+name">Run tests filtering test methods by a name</a> | |
| <li><a href="#label-Publish+documents+to+GitHub+Pages">Publish documents to GitHub Pages</a> | |
| <li><a href="#label-Contributing">Contributing</a> | |
| <li><a href="#label-License">License</a> | |
| </ul> | |
| </div> | |
| <div id="project-metadata"> | |
| <div id="fileindex-section" class="nav-section"> | |
| <h3>Pages</h3> | |
| <ul class="link-list"> | |
| <li><a href="./LICENSE_txt.html">LICENSE</a> | |
| <li><a href="./README_md.html">README</a> | |
| </ul> | |
| </div> | |
| </div> | |
| </nav> | |
| <main role="main" aria-label="Page README.md"> | |
| <h1 id="label-Logger"><a href="Logger.html"><code>Logger</code></a><span><a href="#label-Logger">¶</a> <a href="#top">↑</a></span></h1> | |
| <p><a href="https://travis-ci.com/ruby/logger"><img src="https://travis-ci.com/ruby/logger.svg?branch=master"></a></p> | |
| <p><a href="Logger.html"><code>Logger</code></a> is a simple but powerful logging utility to output messages in your Ruby program.</p> | |
| <p><a href="Logger.html"><code>Logger</code></a> has the following features:</p> | |
| <ul><li> | |
| <p>Print messages to different levels such as <code>info</code> and <code>error</code></p> | |
| </li><li> | |
| <p>Auto-rolling of log files</p> | |
| </li><li> | |
| <p>Setting the format of log messages</p> | |
| </li><li> | |
| <p>Specifying a program name in conjunction with the message</p> | |
| </li></ul> | |
| <h2 id="label-Installation">Installation<span><a href="#label-Installation">¶</a> <a href="#top">↑</a></span></h2> | |
| <p>Add this line to your application's Gemfile:</p> | |
| <pre class="ruby"><span class="ruby-identifier">gem</span> <span class="ruby-string">'logger'</span> | |
| </pre> | |
| <p>And then execute:</p> | |
| <pre>$ bundle</pre> | |
| <p>Or install it yourself as:</p> | |
| <pre>$ gem install logger</pre> | |
| <h2 id="label-Usage">Usage<span><a href="#label-Usage">¶</a> <a href="#top">↑</a></span></h2> | |
| <h3 id="label-Simple+Example">Simple Example<span><a href="#label-Simple+Example">¶</a> <a href="#top">↑</a></span></h3> | |
| <pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'logger'</span> | |
| <span class="ruby-comment"># Create a Logger that prints to STDOUT</span> | |
| <span class="ruby-identifier">log</span> = <span class="ruby-constant">Logger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">STDOUT</span>) | |
| <span class="ruby-identifier">log</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-string">"Created Logger"</span>) | |
| <span class="ruby-identifier">log</span>.<span class="ruby-identifier">info</span>(<span class="ruby-string">"Program finished"</span>) | |
| <span class="ruby-comment"># Create a Logger that prints to STDERR</span> | |
| <span class="ruby-identifier">error_log</span> = <span class="ruby-constant">Logger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">STDERR</span>) | |
| <span class="ruby-identifier">error_log</span> = <span class="ruby-constant">Logger</span>.<span class="ruby-identifier">error</span>(<span class="ruby-string">"fatal error"</span>) | |
| </pre> | |
| <h2 id="label-Development">Development<span><a href="#label-Development">¶</a> <a href="#top">↑</a></span></h2> | |
| <p>After checking out the repo, run the following to install dependencies.</p> | |
| <pre>$ bin/setup</pre> | |
| <p>Then, run the tests as:</p> | |
| <pre>$ rake test</pre> | |
| <p>To install this gem onto your local machine, run</p> | |
| <pre>$ rake install</pre> | |
| <p>To release a new version, update the version number in <code>lib/logger/version.rb</code>, and then run</p> | |
| <pre>$ rake release</pre> | |
| <p>which will create a git tag for the version, push git commits and tags, and push the <code>.gem</code> file to <a href="https://rubygems.org">rubygems.org</a>.</p> | |
| <h2 id="label-Advanced+Development">Advanced Development<span><a href="#label-Advanced+Development">¶</a> <a href="#top">↑</a></span></h2> | |
| <h3 id="label-Run+tests+of+a+specific+file">Run tests of a specific file<span><a href="#label-Run+tests+of+a+specific+file">¶</a> <a href="#top">↑</a></span></h3> | |
| <pre>$ ruby test/logger/test_logger.rb</pre> | |
| <h3 id="label-Run+tests+filtering+test+methods+by+a+name">Run tests filtering test methods by a name<span><a href="#label-Run+tests+filtering+test+methods+by+a+name">¶</a> <a href="#top">↑</a></span></h3> | |
| <p><code>--name</code> option is available as:</p> | |
| <pre>$ ruby test/logger/test_logger.rb --name test_lshift</pre> | |
| <h3 id="label-Publish+documents+to+GitHub+Pages">Publish documents to GitHub Pages<span><a href="#label-Publish+documents+to+GitHub+Pages">¶</a> <a href="#top">↑</a></span></h3> | |
| <pre>$ rake gh-pages</pre> | |
| <p>Then, git commit and push the generated HTMLs onto <code>gh-pages</code> branch.</p> | |
| <h2 id="label-Contributing">Contributing<span><a href="#label-Contributing">¶</a> <a href="#top">↑</a></span></h2> | |
| <p>Bug reports and pull requests are welcome on GitHub at <a href="https://github.com/ruby/logger">github.com/ruby/logger</a>.</p> | |
| <h2 id="label-License">License<span><a href="#label-License">¶</a> <a href="#top">↑</a></span></h2> | |
| <p>The gem is available as open source under the terms of the <a href="LICENSE.txt">BSD-2-Clause</a>.</p> | |
| </main> | |
| <footer id="validator-badges" role="contentinfo"> | |
| <p><a href="https://validator.w3.org/check/referer">Validate</a> | |
| <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.1. | |
| <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>. | |
| </footer> | |