Skip to content

Commit

Permalink
Updated docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
igoramadas committed Jun 16, 2020
1 parent 4c0855e commit 2ea44e0
Show file tree
Hide file tree
Showing 11 changed files with 1,472 additions and 240 deletions.
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,40 +187,40 @@ failFunction()

## Options

#### compact (true)
#### compact: true

Boolean, defines if messages should be compacted, so line breaks and extra spaces will be removed.

#### errorStack (false)
#### errorStack: false

Boolean, defines if stack traces should be logged with errors and exceptions.

#### levels (["info", "warn", "error"])
#### levels: ["info", "warn", "error"]

Array of string, defines which logging levels are enabled. Possible logging levels are
["info", "warn", "error"].

#### levelOnConsole (false)
#### levelOnConsole: false

Boolean, if true it will prepend the log level (INFO, WARN, ERROR etc...) to the message on the console.

#### uncaughtExceptions (false)
#### uncaughtException: false

Boolean, if true it will log uncaught exceptions to the console (but will NOT quit execution).

#### preprocessor
#### preprocessor(args)

You can define a function(arrayOfObjects) that will be used to process arguments before generating
the final log messages. This is useful if you want to change or remove information from objects, for
instance you might want to obfuscate all `password` fields and mask `telephone` fields. The function
can either mutate the arrayOfObjects or return the new arguments as a result.

#### separator (" | ")
#### separator: " | "

String, defines the default separator between logged objects. For instance if you do a
`info(123, "ABC")`, output will be "123 | ABC".

#### styles (object)
#### styles: object

Object with keys defining the styles for each level on console output. This will only be effective
if you also have the [chalk](https://www.npmjs.com/package/chalk) module installed. By default
Expand Down Expand Up @@ -260,8 +260,10 @@ Shortcut to log("error", args).

You can browse the full API documentation at https://anyhow.devv.com.

Or check these following modules that are using Anyhow for logging:
Or check these following projects that are using Anyhow for logging:

* [Expresser](https://github.com/igoramadas/expresser)
* [Monitorado](https://github.com/igoramadas/monitorado)
* [SetMeUp](https://github.com/igoramadas/setmeup)
* [PandaGainz](https://github.com/igoramadas/pandagainz)
* [Strautomator](https://github.com/strautomator/core)
2 changes: 1 addition & 1 deletion docs/assets/js/search.json

Large diffs are not rendered by default.

476 changes: 309 additions & 167 deletions docs/classes/_index_.anyhow.html

Large diffs are not rendered by default.

313 changes: 313 additions & 0 deletions docs/classes/_parser_.anyhowparser.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,313 @@
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>AnyhowParser | Anyhow</title>
<meta name="description" content="Documentation for Anyhow">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">Anyhow</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked />
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
<input type="checkbox" id="tsd-filter-only-exported" />
<label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li>
<a href="../globals.html">Globals</a>
</li>
<li>
<a href="../modules/_parser_.html">&quot;parser&quot;</a>
</li>
<li>
<a href="_parser_.anyhowparser.html">AnyhowParser</a>
</li>
</ul>
<h1>Class AnyhowParser</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel tsd-comment">
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Parser methods to build a message out of passed logging arguments.</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<span class="target">AnyhowParser</span>
</li>
</ul>
</section>
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section tsd-is-not-exported">
<h3>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-not-exported"><a href="_parser_.anyhowparser.html#compact" class="tsd-kind-icon">compact</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-not-exported"><a href="_parser_.anyhowparser.html#errorstack" class="tsd-kind-icon">error<wbr>Stack</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-not-exported"><a href="_parser_.anyhowparser.html#preprocessor" class="tsd-kind-icon">preprocessor</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-not-exported"><a href="_parser_.anyhowparser.html#separator" class="tsd-kind-icon">separator</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-not-exported"><a href="_parser_.anyhowparser.html#timestamp" class="tsd-kind-icon">timestamp</a></li>
</ul>
</section>
<section class="tsd-index-section tsd-is-not-exported">
<h3>Methods</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-not-exported"><a href="_parser_.anyhowparser.html#getmessage" class="tsd-kind-icon">get<wbr>Message</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group tsd-is-not-exported">
<h2>Properties</h2>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-not-exported">
<a name="compact" class="tsd-anchor"></a>
<h3>compact</h3>
<div class="tsd-signature tsd-kind-icon">compact<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = true</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/igoramadas/anyhow/blob/4c0855e/src/parser.ts#L18">parser.ts:18</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Compact logged messages?</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-not-exported">
<a name="errorstack" class="tsd-anchor"></a>
<h3>error<wbr>Stack</h3>
<div class="tsd-signature tsd-kind-icon">error<wbr>Stack<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = false</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/igoramadas/anyhow/blob/4c0855e/src/parser.ts#L28">parser.ts:28</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Log error stack traces?</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-not-exported">
<a name="preprocessor" class="tsd-anchor"></a>
<h3>preprocessor</h3>
<div class="tsd-signature tsd-kind-icon">preprocessor<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Function</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/igoramadas/anyhow/blob/4c0855e/src/parser.ts#L38">parser.ts:38</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Function to pre-process arguments.</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-not-exported">
<a name="separator" class="tsd-anchor"></a>
<h3>separator</h3>
<div class="tsd-signature tsd-kind-icon">separator<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = &quot; | &quot;</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/igoramadas/anyhow/blob/4c0855e/src/parser.ts#L33">parser.ts:33</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Arguments seperator on messages.</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-not-exported">
<a name="timestamp" class="tsd-anchor"></a>
<h3>timestamp</h3>
<div class="tsd-signature tsd-kind-icon">timestamp<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = false</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/igoramadas/anyhow/blob/4c0855e/src/parser.ts#L23">parser.ts:23</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Prepend logged messages with a timestamp?</p>
</div>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group tsd-is-not-exported">
<h2>Methods</h2>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-not-exported">
<a name="getmessage" class="tsd-anchor"></a>
<h3>get<wbr>Message</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-not-exported">
<li class="tsd-signature tsd-kind-icon">get<wbr>Message<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/igoramadas/anyhow/blob/4c0855e/src/parser.ts#L127">parser.ts:127</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Gets a nice, readable message out of the passed arguments, which can be of any type.</p>
</div>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5><span class="tsd-flag ts-flagRest">Rest</span> <span class="tsd-signature-symbol">...</span>args: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Any single or collection of objects that will be transformed to a message string.</p>
</div>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
<p>Human readable string taken out of the parsed arguments.</p>
</li>
</ul>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class="globals ">
<a href="../globals.html"><em>Globals</em></a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/_index_.html">&quot;index&quot;</a>
</li>
<li class="current tsd-kind-module">
<a href="../modules/_parser_.html">&quot;parser&quot;</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/_setup_.html">&quot;setup&quot;</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/_types_.html">&quot;types&quot;</a>
</li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
</ul>
<ul class="current">
<li class="current tsd-kind-class tsd-parent-kind-module tsd-is-not-exported">
<a href="_parser_.anyhowparser.html" class="tsd-kind-icon">Anyhow<wbr>Parser</a>
<ul>
<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-not-exported">
<a href="_parser_.anyhowparser.html#compact" class="tsd-kind-icon">compact</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-not-exported">
<a href="_parser_.anyhowparser.html#errorstack" class="tsd-kind-icon">error<wbr>Stack</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-not-exported">
<a href="_parser_.anyhowparser.html#preprocessor" class="tsd-kind-icon">preprocessor</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-not-exported">
<a href="_parser_.anyhowparser.html#separator" class="tsd-kind-icon">separator</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-not-exported">
<a href="_parser_.anyhowparser.html#timestamp" class="tsd-kind-icon">timestamp</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-not-exported">
<a href="_parser_.anyhowparser.html#getmessage" class="tsd-kind-icon">get<wbr>Message</a>
</li>
</ul>
</li>
</ul>
<ul class="after-current">
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
<div class="container">
<h2>Legend</h2>
<div class="tsd-legend-group">
<ul class="tsd-legend">
<li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
<li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li>
<li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
</ul>
</div>
</div>
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
<script>if (location.protocol == 'file:') document.write('<script src="../assets/js/search.js"><' + '/script>');</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-9331973-4', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>
Loading

0 comments on commit 2ea44e0

Please sign in to comment.