Skip to content

Commit b7e02fe

Browse files
committed
fix: remove deprecated function
BREAKING: removed deprecated function
1 parent 0b3c86a commit b7e02fe

4 files changed

Lines changed: 6 additions & 20 deletions

File tree

README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,7 @@ blapi.setLogging({
8888
logger: yourCustomLogger
8989
})
9090
```
91-
### Turn on extended logging
92-
![](https://img.shields.io/badge/deprecated-Do%20not%20use%20this%20anymore-orange)
9391

94-
```js
95-
// Following method to activate extended logging still works, but is deprecated.
96-
// Switch to using above syntax, as this will be removed at some point.
97-
blapi.setLogging(true);
98-
```
9992

10093
### Turn off the use of the BotBlock API
10194

package-lock.json

Lines changed: 2 additions & 2 deletions
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": "blapi",
3-
"version": "2.2.4",
3+
"version": "3.0.0",
44
"license": "MIT",
55
"repository": "botblock/BLAPI",
66
"bugs": {

src/main.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ type DiscordJSClientFallback = {
6464
[k: string]: any;
6565
};
6666

67-
type LogOptions = boolean | { extended?: boolean; logger?: UserLogger };
67+
type LogOptions = { extended?: boolean; logger?: UserLogger };
6868

6969
let listData = fallbackData as listDataType;
7070
let legacyIds = legacyIdsFallbackData as legacyIdDataType;
@@ -432,14 +432,8 @@ export async function manualPost(
432432
}
433433

434434
export function setLogging(logOptions: LogOptions): void {
435-
// we are setting extendedLogging to the passed in logOptions
436-
// so users can disable extended logging later on
437-
if (typeof logOptions === 'boolean') {
438-
extendedLogging = logOptions;
439-
}
440435
if (
441-
typeof logOptions === 'object'
442-
&& Object.prototype.hasOwnProperty.call(logOptions, 'extended')
436+
Object.prototype.hasOwnProperty.call(logOptions, 'extended')
443437
&& typeof logOptions.extended === 'boolean'
444438
) {
445439
extendedLogging = logOptions.extended;
@@ -448,7 +442,7 @@ export function setLogging(logOptions: LogOptions): void {
448442
if (!Object.prototype.hasOwnProperty.call(logOptions, 'logger')) {
449443
return;
450444
}
451-
const { logger } = logOptions as any; // we checked that it exists beforehand
445+
const logger = logOptions.logger!; // we checked that it exists beforehand
452446
// making sure the logger supplied by the user has our required log levels (info, warn, error)
453447
if (
454448
typeof logger.info !== 'function'
@@ -459,7 +453,6 @@ export function setLogging(logOptions: LogOptions): void {
459453
'Your supplied logger does not seem to expose the log levels BLAPI needs to work. Make sure your logger offers the following methods: info() warn() error()',
460454
);
461455
}
462-
// @ts-ignore
463456
userLogger = logOptions.logger;
464457
}
465458

0 commit comments

Comments
 (0)