i-log
Version:
debug module extensions
70 lines (52 loc) • 3.88 kB
HTML
<html lang="en-us">
<head>
<meta charset="UTF-8">
<title>I-log by donateoa</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="stylesheets/normalize.css" media="screen">
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="stylesheets/stylesheet.css" media="screen">
<link rel="stylesheet" type="text/css" href="stylesheets/github-light.css" media="screen">
</head>
<body>
<section class="page-header">
<h1 class="project-name">I-log</h1>
<h2 class="project-tagline">share logger between nodejs modules</h2>
<a href="https://github.com/donateoa/i-log" class="btn">View on GitHub</a>
<a href="https://github.com/donateoa/i-log/zipball/master" class="btn">Download .zip</a>
<a href="https://github.com/donateoa/i-log/tarball/master" class="btn">Download .tar.gz</a>
</section>
<section class="main-content">
<h1>
<a id="i-log" class="anchor" href="#i-log" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>i-log</h1>
<p>Share logger between nodejs modules.
Use a dedicate key for each module and filter the module you want is writing.</p>
<h2>
<a id="install" class="anchor" href="#install" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Install</h2>
<div class="highlight highlight-source-shell"><pre>$ npm install --save i-log</pre></div>
<h2>
<a id="configuration" class="anchor" href="#configuration" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Configuration</h2>
<p>setting DEBUG variable when run your modules </p>
<div class="highlight highlight-source-shell"><pre><span class="pl-c"># print all keys</span>
DEBUG=i_log:<span class="pl-k">*</span> npm start</pre></div>
<div class="highlight highlight-source-shell"><pre><span class="pl-c"># print info keys</span>
DEBUG=i_log:info npm start</pre></div>
<h2>
<a id="usage" class="anchor" href="#usage" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Usage</h2>
<div class="highlight highlight-source-shell"><pre>var i_log = require(<span class="pl-s"><span class="pl-pds">'</span>i_log<span class="pl-pds">'</span></span>)(<span class="pl-s"><span class="pl-pds">"</span>your_module<span class="pl-pds">"</span></span>)
i_log.info(<span class="pl-s"><span class="pl-pds">"</span>test info<span class="pl-pds">"</span></span>)
i_log.debug(<span class="pl-s"><span class="pl-pds">"</span>test debug<span class="pl-pds">"</span></span>)
i_log.error(<span class="pl-s"><span class="pl-pds">"</span>test error<span class="pl-pds">"</span></span>)</pre></div>
<h2>
<a id="output" class="anchor" href="#output" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Output</h2>
<div class="highlight highlight-source-shell"><pre>your_module:info Wed Oct 19 2016 16:53:03 GMT+0200 (CEST) <span class="pl-c1">test</span> info +0ms
your_module:debug Wed Oct 19 2016 16:53:03 GMT+0200 (CEST) <span class="pl-c1">test</span> debug +117ms
your_module:error Wed Oct 19 2016 16:53:03 GMT+0200 (CEST) <span class="pl-c1">test</span> error +117ms</pre></div>
<footer class="site-footer">
<span class="site-footer-owner"><a href="https://github.com/donateoa/i-log">I-log</a> is maintained by <a href="https://github.com/donateoa">donateoa</a>.</span>
<span class="site-footer-credits">This page was generated by <a href="https://pages.github.com">GitHub Pages</a> using the <a href="https://github.com/jasonlong/cayman-theme">Cayman theme</a> by <a href="https://twitter.com/jasonlong">Jason Long</a>.</span>
</footer>
</section>
</body>
</html>