Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tiny-bees-pump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperdx/node-opentelemetry': patch
---

fix: rename getWinsonTransport to getWinstonTransport
4 changes: 2 additions & 2 deletions packages/node-opentelemetry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ configure your logging module.

```ts
import winston from 'winston';
import { getWinsonTransport } from '@hyperdx/node-opentelemetry';
import { getWinstonTransport } from '@hyperdx/node-opentelemetry';

const MAX_LEVEL = 'info';

Expand All @@ -34,7 +34,7 @@ const logger = winston.createLogger({
format: winston.format.json(),
transports: [
new winston.transports.Console(),
getWinsonTransport(MAX_LEVEL), // append this to the existing transports
getWinstonTransport(MAX_LEVEL), // append this to the existing transports
],
});

Expand Down
7 changes: 5 additions & 2 deletions packages/node-opentelemetry/__tests__/logger.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import winston from 'winston';

import { getWinsonTransport } from '../src/logger';
import { getWinstonTransport } from '../src/logger';

const MAX_LEVEL = 'info';

const winstonLogger = winston.createLogger({
level: MAX_LEVEL,
format: winston.format.json(),
transports: [new winston.transports.Console(), getWinsonTransport(MAX_LEVEL)],
transports: [
new winston.transports.Console(),
getWinstonTransport(MAX_LEVEL),
],
});

describe('logger', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/node-opentelemetry/examples/dummy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const pino = require('pino');
const winston = require('winston');

const {
getWinsonTransport,
getPinoTransport,
getWinstonTransport,
init,
} = require('../build/src/logger');
const { setTraceAttributes } = require('../build/src');
Expand All @@ -25,7 +25,7 @@ const logger = winston.createLogger({
level: 'info',
format: winston.format.json(),
transports: [
getWinsonTransport('info'), // append this to the existing transports
getWinstonTransport('info'), // append this to the existing transports
],
});

Expand Down
5 changes: 4 additions & 1 deletion packages/node-opentelemetry/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const getCustomMeta = () => {
return traceId ? hyperDXGlobalContext.getTraceAttributes(traceId) : {};
};

export const getWinsonTransport = (
export const getWinstonTransport = (
maxLevel = 'info',
options: WinstonTransportOptions = {},
) => {
Expand All @@ -45,6 +45,9 @@ export const getWinsonTransport = (
});
};

// TODO: WILL BE DEPRECATED
export const getWinsonTransport = getWinstonTransport;

export const getPinoTransport = (
maxLevel = 'info',
options: PinotTransportOptions = {},
Expand Down