Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed all outstanding deprecations #1057

Merged
merged 3 commits into from
Jul 8, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 0 additions & 18 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,6 @@ the object is an instance of `Error`, e.g. `logger.info(new Error('kaboom'))`.

* See [pino.stdSerializers](#pino-stdserializers)

##### `serializers[Symbol.for('pino.*')]` (Function) - DEPRECATED

Use `formatters.log` instead.

#### `base` (Object)

Default: `{pid: process.pid, hostname: os.hostname}`
Expand Down Expand Up @@ -363,20 +359,6 @@ must be installed as a separate dependency:
npm install pino-pretty
```

<a id="useLevelLabels"></a>
#### `useLevelLabels` (Boolean) - DEPRECATED

Use `formatters.level` instead. This will be removed in v7.

<a id="changeLevelName"></a>
#### `changeLevelName` (String) - DEPRECATED
Use `formatters.level` instead. This will be removed in v7.

<a id="levelKey"></a>
#### `levelKey` (String) - DEPRECATED

Use `formatters.level` instead. This will be removed in v7.

#### `browser` (Object)

Browser only, may have `asObject` and `write` keys. This option is separately
Expand Down
13 changes: 1 addition & 12 deletions pino.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,18 +314,7 @@ declare namespace P {
* requires supplying a level value via `levelVal`. Default: 'info'.
*/
level?: LevelWithSilent | string;
/**
* Outputs the level as a string instead of integer. Default: `false`.
*/
useLevelLabels?: boolean;
/**
* Changes the property `level` to any string value you pass in. Default: 'level'
*/
levelKey?: string;
/**
* (DEPRECATED, use `levelKey`) Changes the property `level` to any string value you pass in. Default: 'level'
*/
changeLevelName?: string;

/**
* Use this option to define additional logging levels.
* The keys of the object correspond the namespace of the log level, and the values should be the numerical value of the level.
Expand Down
37 changes: 0 additions & 37 deletions pino.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ const defaultOptions = {
name: undefined,
redact: null,
customLevels: null,
levelKey: undefined,
useOnlyCustomLevels: false
}

Expand All @@ -88,9 +87,6 @@ function pino (...args) {
name,
level,
customLevels,
useLevelLabels,
changeLevelName,
levelKey,
mixin,
useOnlyCustomLevels,
formatters,
Expand All @@ -103,23 +99,6 @@ function pino (...args) {
formatters.log
)

if (useLevelLabels && !(changeLevelName || levelKey)) {
process.emitWarning('useLevelLabels is deprecated, use the formatters.level option instead', 'Warning', 'PINODEP001')
allFormatters.level = labelsFormatter
} else if ((changeLevelName || levelKey) && !useLevelLabels) {
process.emitWarning('changeLevelName and levelKey are deprecated, use the formatters.level option instead', 'Warning', 'PINODEP002')
allFormatters.level = levelNameFormatter(changeLevelName || levelKey)
} else if ((changeLevelName || levelKey) && useLevelLabels) {
process.emitWarning('useLevelLabels is deprecated, use the formatters.level option instead', 'Warning', 'PINODEP001')
process.emitWarning('changeLevelName and levelKey are deprecated, use the formatters.level option instead', 'Warning', 'PINODEP002')
allFormatters.level = levelNameLabelFormatter(changeLevelName || levelKey)
}

if (serializers[Symbol.for('pino.*')]) {
process.emitWarning('The pino.* serializer is deprecated, use the formatters.log options instead', 'Warning', 'PINODEP003')
allFormatters.log = serializers[Symbol.for('pino.*')]
}

if (!allFormatters.bindings) {
allFormatters.bindings = defaultOptions.formatters.bindings
}
Expand Down Expand Up @@ -191,22 +170,6 @@ function pino (...args) {
return instance
}

function labelsFormatter (label, number) {
return { level: label }
}

function levelNameFormatter (name) {
return function (label, number) {
return { [name]: number }
}
}

function levelNameLabelFormatter (name) {
return function (label, number) {
return { [name]: label }
}
}

module.exports = pino

module.exports.extreme = (dest = process.stdout.fd) => {
Expand Down
6 changes: 3 additions & 3 deletions test/basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ test('correctly skip function', async (t) => {
instance.info(o, () => {})

const { msg } = await once(stream, 'data')
t.is(msg, undefined)
t.equal(msg, undefined)
})

test('correctly skip Infinity', async (t) => {
Expand All @@ -686,7 +686,7 @@ test('correctly skip Infinity', async (t) => {
instance.info(o, Infinity)

const { msg } = await once(stream, 'data')
t.is(msg, null)
t.equal(msg, null)
})

test('correctly log number', async (t) => {
Expand All @@ -697,5 +697,5 @@ test('correctly log number', async (t) => {
instance.info(o, 42)

const { msg } = await once(stream, 'data')
t.is(msg, 42)
t.equal(msg, 42)
})
101 changes: 0 additions & 101 deletions test/deprecations.test.js

This file was deleted.

9 changes: 0 additions & 9 deletions test/levels.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,6 @@ test('resets levels from labels to numbers', async ({ equal }) => {
instance.info('hello world')
})

test('aliases changeLevelName to levelKey', async ({ equal }) => {
const instance = pino({ changeLevelName: 'priority' }, sink((result, enc, cb) => {
equal(result.priority, 30)
cb()
}))

instance.info('hello world')
})

test('changes label naming when told to', async ({ equal }) => {
const expected = [{
priority: 30,
Expand Down
6 changes: 3 additions & 3 deletions test/redact.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -776,14 +776,14 @@ test('child bindings are redacted using wildcard and plain path keys', async ({
equal(req.method, '[Redacted]')
})

test('redacts boolean at the top level', async ({ is }) => {
test('redacts boolean at the top level', async ({ equal }) => {
const stream = sink()
const instance = pino({ redact: ['msg'] }, stream)
const obj = {
s: 's'
}
instance.info(obj, true)
const o = await once(stream, 'data')
is(o.s, 's')
is(o.msg, '[Redacted]')
equal(o.s, 's')
equal(o.msg, '[Redacted]')
})
11 changes: 7 additions & 4 deletions test/serializers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ test('children inherit parent serializers', async ({ equal }) => {
test('children inherit parent Symbol serializers', async ({ equal, same, not }) => {
const stream = sink()
const symbolSerializers = {
[Symbol.for('pino.*')]: parentSerializers.test
[Symbol.for('b')]: b
}
const expected = Object.assign({
err: stdSerializers.err
Expand All @@ -175,10 +175,13 @@ test('children inherit parent Symbol serializers', async ({ equal, same, not })
return 'hello'
}

not(child[Symbol.for('pino.serializers')], symbolSerializers)
function b () {
return 'world'
}

same(child[Symbol.for('pino.serializers')].a, a)
same(child[Symbol.for('pino.serializers')][Symbol.for('b')], b)
same(child[Symbol.for('pino.serializers')][Symbol.for('a')], a)
same(child[Symbol.for('pino.serializers')][Symbol.for('pino.*')], parentSerializers.test)
})

test('children serializers get called', async ({ equal }) => {
Expand Down Expand Up @@ -246,5 +249,5 @@ test('custom serializer for messageKey', async (t) => {
instance.info(o, 42)

const { msg } = await once(stream, 'data')
t.is(msg, '422')
t.equal(msg, '422')
})
2 changes: 0 additions & 2 deletions test/types/pino.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ pino({
});

pino({ base: null });
pino({ base: { foo: "bar" }, changeLevelName: "severity" });
pino({ base: { foo: "bar" }, levelKey: "severity" });
if ("pino" in log) console.log(`pino version: ${log.pino}`);

log.child({ a: "property" }).info("hello child!");
Expand Down