Create a console logger w/ formatting, timestamp, color, namespace _Source: [lib/long-con/index.js](../lib/long-con/index.js)_ - [exports.LongCon](#exportslongcon) - [exports.create](#exportscreate) - [exports.extend](#exportsextendext) - [LongCon](#longcon) - [LongCon.prototype.log](#longconprototypelogname-fn-namecolor-bodycolor-args) - [LongCon.prototype.create](#longconprototypecreate) - [LongCon.prototype.traceMethods](#longconprototypetracemethodsname-obj-logger-filterall-omitnone) # exports.LongCon() > Reference to [LongCon](#longcon). Go: [TOC](#tableofcontents) | [exports](#toc_exports) # exports.create() > Create a new [LongCon](#longcon). **Return:** `{LongCon}` Go: [TOC](#tableofcontents) | [exports](#toc_exports) # exports.extend(ext) > Extend [LongCon](#longcon).prototype. **Parameters:** - `{object} ext` Methods to mix in. **Return:** `{object}` Merge result. Go: [TOC](#tableofcontents) | [exports](#toc_exports) # LongCon() > LongCon constructor. **Usage:** ```js var longCon = require('long-con').create(); // new LongCon() instance ``` **Example configuration:** ```js loncCon .set('namespace', 'myLib'); var log = longCon.create('[stderr]', console.error, 'red.bold'); // [stderr] myLib error message: ... log('error message: %s', ...); ``` **Configuration:** - `{string} [namespace='']` Prepend to each message - `{string} [nlFirst=false]` Prepend `\n` to first log - `{string} [quiet=false]` Drop all messages - `{string} [time=false]` Prepend `toUTCString()` - `{string} [traceIndent=' ']` Represent a stack level (default: 4 spaces) - `{string} [traceLanes=true]` Prepend each traceIndent with `|` **Properties:** - `{number} [stackDepth=0]` Used to size indentation and draw trace lanes - `{boolean} firstLine` Supports `nlFirst` config option **See:** - [cli-color](https://github.com/medikoo/cli-color) Go: [TOC](#tableofcontents) # LongCon.prototype.log(name, fn, nameColor, bodyColor, args*) > `util.format()` wrapper with timestamp and injected output function. Respects `quiet` config. Applies color selection. **Parameters:** - `{string} name` Source logger's name, ex. 'stderr' - `{function} fn` Ex. `console.error` - `{string} nameColor` `name` color, ex. 'yellow' or 'white.bgRed' - `cli-color` foreground and optional background - `{boolean | string} bodyColor` {boolean} If true, match `nameColor` {string} Custom `cli-color` - `{mixed} args*` `util.format()` compatible **See:** - [cli-color](https://github.com/medikoo/cli-color) Go: [TOC](#tableofcontents) | [LongCon.prototype](#toc_longconprototype) # LongCon.prototype.create() > Create a [LongCon.prototype.log](#longconprototypelogname-fn-namecolor-bodycolor-args) wrapper with fixed arguments. Returned function ('primary') also has two properties. - `{function} push`: Emits a log message and pushes a stack level. - Accepts same arguments as primary. - `{function} pop`: Pops a stack level. Optionally emits a log message. - Optionally accepts same arguments as primary. **Return:** `{function}` Accepts `util.format()` arguments **See:** - [LongCon.prototype.log](#longconprototypelogname-fn-namecolor-bodycolor-args) for fixable arguments Go: [TOC](#tableofcontents) | [LongCon.prototype](#toc_longconprototype) # LongCon.prototype.traceMethods(name, obj, logger, [filter=all], [omit=none]) > Wrap an object's methods to allow log messages to appear within a stack trace isolated to that object. **Parameters:** - `{string} name` Uniquely identify the object - `{object} obj` - `{function} logger` From [LongCon.prototype.create](#longconprototypecreate) - `{regexp | object} [filter=all]` Include matching key names - `filter`: If an object, its keys are used. - `{regexp} [omit=none]` Exclude matching key names Go: [TOC](#tableofcontents) | [LongCon.prototype](#toc_longconprototype) _—generated by [apidox](https://github.com/codeactual/apidox)—_