Skip to content
This repository was archived by the owner on Feb 5, 2026. It is now read-only.

Commit bbbc665

Browse files
LOG-16439 Fix error with missing winston dependency (#18)
1 parent 8dd0614 commit bbbc665

File tree

4 files changed

+43
-20
lines changed

4 files changed

+43
-20
lines changed

README.md

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,34 @@ There’s a separate client intended for use in the browser, called
1010
[r7insight_js](https://github.com/rapid7/r7insight_js), which uses http and is optimized
1111
for browser-specific logging needs.
1212

13-
<!-- MarkdownTOC autolink=true bracket=round -->
14-
15-
- [Start](#start)
16-
- [Development](#development)
17-
- [Options](#options)
18-
- [Log Levels](#log-levels)
19-
- [Events](#events)
20-
- [Log Entries](#log-entries)
21-
- [Methods](#methods)
22-
- [Buffer & Connection Issues](#buffer--connection-issues)
23-
- [Using as a Winston ‘Transport’](#using-as-a-winston-transport)
24-
- [Using with Bunyan](#using-with-bunyan)
25-
- [Using with Ts.ED Logger](#using-with-ts-ed-logger)
26-
27-
<!-- /MarkdownTOC -->
13+
- [r7insight_node: Insight Platform Client](#r7insight_node-insight-platform-client)
14+
- [Start](#start)
15+
- [Development](#development)
16+
- [Options](#options)
17+
- [Required](#required)
18+
- [Behavior](#behavior)
19+
- [Log Processing Options`](#log-processing-options)
20+
- [Other](#other)
21+
- [Log Levels](#log-levels)
22+
- [Events](#events)
23+
- [Logger Events](#logger-events)
24+
- [`'error'`](#error)
25+
- [`'log'`](#log)
26+
- [`'connected'` and `'disconnected'` and `'timed out'`](#connected-and-disconnected-and-timed-out)
27+
- [`'drain'`, `'finish'`, `'pipe'`, and `'unpipe'`](#drain-finish-pipe-and-unpipe)
28+
- [`'buffer drain'`](#buffer-drain)
29+
- [RingBuffer Events](#ringbuffer-events)
30+
- [`'buffer shift'`](#buffer-shift)
31+
- [Log Entries](#log-entries)
32+
- [Object Serialization](#object-serialization)
33+
- [Optional Augmentation](#optional-augmentation)
34+
- [Flattening Log Objects](#flattening-log-objects)
35+
- [Methods](#methods)
36+
- [Buffering](#buffering)
37+
- [Connection Handling](#connection-handling)
38+
- [Using as a Winston ‘Transport’](#using-as-a-winston-transport)
39+
- [Pre-requisites](#pre-requisites)
40+
- [Using with Bunyan](#using-with-bunyan)
2841

2942
## Start
3043

@@ -318,8 +331,15 @@ some other means with which a token can be tested for validity.
318331
319332
## Using as a Winston ‘Transport’
320333
321-
If Winston is included in your package.json dependencies, simply requiring the
322-
Insight client will place the transport constructor at `winston.transports`,
334+
### Pre-requisites
335+
336+
- `winston` and `winston-transport` installed
337+
* Check [package.json](./package.json) for currently supported version
338+
339+
If Winston is included in your package.json dependencies, you can just require the Insight Logger
340+
to initialize it.
341+
342+
The Insight client will place the transport constructor at `winston.transports`,
323343
even if Winston itself hasn’t yet been required.
324344
325345
```javascript
@@ -329,6 +349,9 @@ const winston = require('winston');
329349
assert(winston.transports.Insight);
330350
```
331351
352+
Winston is an optional dependency in `r7insight_node` and and if included it
353+
requires `winston-transport` for the `InsightTransport` to extend it.
354+
332355
When adding a new Insight transport, the options argument passed to Winston’s
333356
`add` method supports the usual options in addition to those which are Winston-
334357
specific. If custom levels are not provided, Winston’s defaults will be used.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "r7insight_node",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"description": "Rapid7 Insight Platform client for node; use with or without Winston or Bunyan.",
55
"keywords": [
66
"logentries",

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const Transport = requirePeer('winston-transport', {optional: true});
1818

1919
// If we have successfully loaded winston (user has it)
2020
// we initialize our InsightTransport
21-
if (winston) {
21+
if (winston && Transport) {
2222
provisionWinston(winston, Transport);
2323
}
2424

0 commit comments

Comments
 (0)