From c924043202c10cac8d7895f8fcb0a34d90c06b54 Mon Sep 17 00:00:00 2001 From: shellscape Date: Mon, 18 Dec 2017 00:27:56 -0500 Subject: [PATCH] cleaning up doc definition formats --- README.md | 10 +++++----- docs/LogLevel.md | 18 +++++++++--------- docs/MethodFactory.md | 32 ++++++++++++++------------------ 3 files changed, 28 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index c5cd6b2..b2c680b 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ wrapped with that same extra sugar. Please see [`LogLevel`](docs/LogLevel.md) for documentation of all methods and properties of every log instance, including the default instance. -### `trace`, `debug`, `info`, `warn`, `error` +#### `trace`, `debug`, `info`, `warn`, `error` These methods correspond to the available log levels and accept parameters identical to their `console` counterparts. eg. @@ -92,12 +92,12 @@ console.info('...'); // ... etc ``` -### `getLogger(options)` +#### `getLogger(options)` Returns a new `LogLevel` instance. The `options` parameter should be an `Object` matching the options for the [`LogLevel`](docs/LogLevel.md) constructor. -### `noConflict()` +#### `noConflict()` When using `loglevelnext` in a browser environment, you may encounter a scenario in which `window.log` is already assigned when the script loads, resulting in @@ -106,7 +106,7 @@ in which `window.log` is already assigned when the script loads, resulting in ### Properties -### `factories` +#### `factories` Type: `Array [ Class ]` @@ -119,7 +119,7 @@ const { MethodFactory } = log.factories; class MyFactory extends MethodFactory { ... } ``` -### `loggers` +#### `loggers` Type: `Array [ LogLevel ]` diff --git a/docs/LogLevel.md b/docs/LogLevel.md index ac8719b..dc89ddc 100644 --- a/docs/LogLevel.md +++ b/docs/LogLevel.md @@ -21,7 +21,7 @@ pairs: ## Methods -## constructor(options) +### `constructor(options)` The constructor for this class accepts an `options` Object. The following is a property reference for the Object: @@ -74,17 +74,17 @@ disable() { this.level = this.levels.SILENT; } -## `disable` +### `disable` Instructs the logger to hide output for every log level. This is equivalent to setting the `level` property to `'silent'` or `5`. -## `enable` +### `enable` Instructs the logger to produce output for every log level. This is equivalent to setting the `level` property to `'trace'` or `0`. -## Properties +### Properties #### `level(options)` @@ -130,7 +130,7 @@ For example: Would then result in a prefix of `'bar-'` prepended to the output for each log method call. -#### `time()` +### `time()` Type: `Function` Default: `() => new Date().toTimeString().split(' ')[0]` @@ -139,23 +139,23 @@ A function used to define the value used to replace instances of `{{time}}` within the [prefix template](#template). This function should represent the time at which the logger produced output. -## Properties +### Properties -### `factory` +#### `factory` Type: `Class:MethodFactory` Gets or sets the factory to use when wrapping `console` methods. When setting this property, the value must be a class which inherits from `MethodFactory`. -### `level` +#### `level` Type: `String|Number` Gets or sets the level the log should operate on. When setting this property, the value must be a `String` or `Number.` -## `levels` +#### `levels` Type: `Object` diff --git a/docs/MethodFactory.md b/docs/MethodFactory.md index a88c355..2a3b600 100644 --- a/docs/MethodFactory.md +++ b/docs/MethodFactory.md @@ -5,7 +5,7 @@ responsible for wrapping `console` methods to provide logging functionality. ## Methods -## `bindMethod(obj, methodName)` +### `bindMethod(obj, methodName)` Binds a corresponding `console` method to the object specified. @@ -13,17 +13,15 @@ Returns: `Function` ### Parameters -### `obj` +#### `obj` Type: `Object` -### `methodName` +#### `methodName` Type: `String` -### Parameters - -## `distillLevel(level)` +### `distillLevel(level)` Processes a valid level value and returns the numerical value. @@ -31,13 +29,13 @@ Returns: `Number` ### Parameters -### `level` +#### `level` Type: `Any` The level to process. -## `levelValid(level)` +### `levelValid(level)` Determines if a given log level corresponds to a name or value in `levels`. @@ -45,21 +43,19 @@ Returns: `Boolean` ### Parameters -### `level` +#### `level` Type: `Any` The level to check. -### Parameters - -## `make(methodName)` +### `make(methodName)` Contains logic for binding the specified method and adding it to the logger. ### Parameters -### `methodName` +#### `methodName` Type: `String` @@ -70,15 +66,15 @@ The method to create. The entry point for `LogLevel` instances to request binding and wrapping of log methods. -### Properties +### Parameters -### `logLevel` +#### `logLevel` Type: `String|Number` Specifies the minimum level that will produce log output. The value must be a `String` or `Number.` -## `levels` +### `levels` Type: `Object` @@ -86,13 +82,13 @@ Gets an object which represents the valid level name-value pairs for this log instance. The return value will match the same property in [`LogLevel`](LogLevel.md). -## `logger` +### `logger` Type: `LogLevel` Gets or sets the logger that the factory will operate on. -## `methods` +### `methods` Type: `Array [ String ]`