]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/npmlog/README.md
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / npmlog / README.md
1 # npmlog
2
3 The logger util that npm uses.
4
5 This logger is very basic.  It does the logging for npm.  It supports
6 custom levels and colored output.
7
8 By default, logs are written to stderr.  If you want to send log messages
9 to outputs other than streams, then you can change the `log.stream`
10 member, or you can just listen to the events that it emits, and do
11 whatever you want with them.
12
13 # Basic Usage
14
15 ```
16 var log = require('npmlog')
17
18 // additional stuff ---------------------------+
19 // message ----------+                         |
20 // prefix ----+      |                         |
21 // level -+   |      |                         |
22 //        v   v      v                         v
23     log.info('fyi', 'I have a kitty cat: %j', myKittyCat)
24 ```
25
26 ## log.level
27
28 * {String}
29
30 The level to display logs at.  Any logs at or above this level will be
31 displayed.  The special level `silent` will prevent anything from being
32 displayed ever.
33
34 ## log.record
35
36 * {Array}
37
38 An array of all the log messages that have been entered.
39
40 ## log.maxRecordSize
41
42 * {Number}
43
44 The maximum number of records to keep.  If log.record gets bigger than
45 10% over this value, then it is sliced down to 90% of this value.
46
47 The reason for the 10% window is so that it doesn't have to resize a
48 large array on every log entry.
49
50 ## log.prefixStyle
51
52 * {Object}
53
54 A style object that specifies how prefixes are styled.  (See below)
55
56 ## log.headingStyle
57
58 * {Object}
59
60 A style object that specifies how the heading is styled.  (See below)
61
62 ## log.heading
63
64 * {String} Default: ""
65
66 If set, a heading that is printed at the start of every line.
67
68 ## log.stream
69
70 * {Stream} Default: `process.stderr`
71
72 The stream where output is written.
73
74 ## log.enableColor()
75
76 Force colors to be used on all messages, regardless of the output
77 stream.
78
79 ## log.disableColor()
80
81 Disable colors on all messages.
82
83 ## log.enableProgress()
84
85 Enable the display of log activity spinner and progress bar
86
87 ## log.disableProgress()
88
89 Disable the display of a progress bar
90
91 ## log.enableUnicode()
92
93 Force the unicode theme to be used for the progress bar.
94
95 ## log.disableUnicode()
96
97 Disable the use of unicode in the progress bar.
98
99 ## log.setGaugeTemplate(template)
100
101 Overrides the default gauge template.
102
103 ## log.pause()
104
105 Stop emitting messages to the stream, but do not drop them.
106
107 ## log.resume()
108
109 Emit all buffered messages that were written while paused.
110
111 ## log.log(level, prefix, message, ...)
112
113 * `level` {String} The level to emit the message at
114 * `prefix` {String} A string prefix.  Set to "" to skip.
115 * `message...` Arguments to `util.format`
116
117 Emit a log message at the specified level.
118
119 ## log\[level](prefix, message, ...)
120
121 For example,
122
123 * log.silly(prefix, message, ...)
124 * log.verbose(prefix, message, ...)
125 * log.info(prefix, message, ...)
126 * log.http(prefix, message, ...)
127 * log.warn(prefix, message, ...)
128 * log.error(prefix, message, ...)
129
130 Like `log.log(level, prefix, message, ...)`.  In this way, each level is
131 given a shorthand, so you can do `log.info(prefix, message)`.
132
133 ## log.addLevel(level, n, style, disp)
134
135 * `level` {String} Level indicator
136 * `n` {Number} The numeric level
137 * `style` {Object} Object with fg, bg, inverse, etc.
138 * `disp` {String} Optional replacement for `level` in the output.
139
140 Sets up a new level with a shorthand function and so forth.
141
142 Note that if the number is `Infinity`, then setting the level to that
143 will cause all log messages to be suppressed.  If the number is
144 `-Infinity`, then the only way to show it is to enable all log messages.
145
146 ## log.newItem(name, todo, weight)
147
148 * `name` {String} Optional; progress item name.
149 * `todo` {Number} Optional; total amount of work to be done. Default 0.
150 * `weight` {Number} Optional; the weight of this item relative to others. Default 1.
151
152 This adds a new `are-we-there-yet` item tracker to the progress tracker. The
153 object returned has the `log[level]` methods but is otherwise an
154 `are-we-there-yet` `Tracker` object.
155
156 ## log.newStream(name, todo, weight)
157
158 This adds a new `are-we-there-yet` stream tracker to the progress tracker. The
159 object returned has the `log[level]` methods but is otherwise an
160 `are-we-there-yet` `TrackerStream` object.
161
162 ## log.newGroup(name, weight)
163
164 This adds a new `are-we-there-yet` tracker group to the progress tracker. The
165 object returned has the `log[level]` methods but is otherwise an
166 `are-we-there-yet` `TrackerGroup` object.
167
168 # Events
169
170 Events are all emitted with the message object.
171
172 * `log` Emitted for all messages
173 * `log.<level>` Emitted for all messages with the `<level>` level.
174 * `<prefix>` Messages with prefixes also emit their prefix as an event.
175
176 # Style Objects
177
178 Style objects can have the following fields:
179
180 * `fg` {String} Color for the foreground text
181 * `bg` {String} Color for the background
182 * `bold`, `inverse`, `underline` {Boolean} Set the associated property
183 * `bell` {Boolean} Make a noise (This is pretty annoying, probably.)
184
185 # Message Objects
186
187 Every log event is emitted with a message object, and the `log.record`
188 list contains all of them that have been created.  They have the
189 following fields:
190
191 * `id` {Number}
192 * `level` {String}
193 * `prefix` {String}
194 * `message` {String} Result of `util.format()`
195 * `messageRaw` {Array} Arguments to `util.format()`