You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+85-1Lines changed: 85 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,9 @@ A thin wrapper for visionmedia/debug logger, adding levels and colored output.
9
9
[visionmedia/debug](https://github.com/visionmedia/debug) is a ubitiquous logging library with 1000+ dependants. Given how widespread it is and the convenience of namespaces it is a great logger for library modules.
10
10
`debug-logger` is a convenience wrapper around `debug` that adds level based coloured output. Each instance of `debug-logger` will lazily instantiate several instances of `debug` such as `namespace:info`, `namespace:warn`, `namespace:error`, etc. All these are configurable. `debug-logger` has no dependencies besides `debug`.
11
11
12
+
`debug-logger` uses the same syntax as [node.js console](https://nodejs.org/api/console.html) so you can use it as drop in replacement.
13
+
Check and run [examples/console.parity.js](https://github.com/appscot/debug-logger/blob/master/examples/console.parity.js) for more details.
14
+
12
15
At AppsCot we use `debug-logger` in [waterline-orientdb](https://github.com/appscot/waterline-orientdb).
@@ -132,12 +195,33 @@ Prints the data prepended by log level. If the terminal supports colors, each le
132
195
```
133
196
This function can take multiple arguments in a printf()-like way, if formatting elements are not found in the first string then util.inspect is used on each argument.
134
197
198
+
#### `log([message][, ...])`
199
+
Outputs the message using the root/default `debug` instance, without the level suffix. Example:
200
+
```
201
+
myapp I'm a root/default debug instance output +0ms
202
+
```
203
+
135
204
#### `log[level].logger()`
136
-
Returns the default debug instance used by `level`.
205
+
Returns the default `debug` instance used by `level`.
137
206
138
207
#### `log[level].enabled()`
139
208
Boolean indicating if `level`'s logger is enabled.
140
209
210
+
#### `log.time(label)`
211
+
Mark a time.
212
+
213
+
#### `log.timeEnd(label[, level])`
214
+
Finish timer, record output. `level` will determine the logger used to output the result (defaults to 'log').
215
+
Return duration in ms.
216
+
217
+
#### `log.dir(obj[, options][, level])`
218
+
Uses util.inspect on obj and prints resulting string to the appropriate logger. This function bypasses any custom inspect() function on obj. An optional [options object](https://nodejs.org/api/console.html#console_console_dir_obj_options) may be passed that alters certain aspects of the formatted string.
219
+
`level` will determine the logger used to output the result (defaults to 'log').
0 commit comments