diff --git a/README.md b/README.md index 1eb8470..91390e0 100644 --- a/README.md +++ b/README.md @@ -88,14 +88,7 @@ blapi.setLogging({ logger: yourCustomLogger }) ``` -### Turn on extended logging -![](https://img.shields.io/badge/deprecated-Do%20not%20use%20this%20anymore-orange) -```js -// Following method to activate extended logging still works, but is deprecated. -// Switch to using above syntax, as this will be removed at some point. -blapi.setLogging(true); -``` ### Turn off the use of the BotBlock API diff --git a/package-lock.json b/package-lock.json index 254b872..c4ae76b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "blapi", - "version": "2.2.4", + "version": "3.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "blapi", - "version": "2.2.4", + "version": "3.0.0", "license": "MIT", "dependencies": { "centra": "^2.5.0" diff --git a/package.json b/package.json index 62de603..d826073 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blapi", - "version": "2.2.4", + "version": "3.0.0", "license": "MIT", "repository": "botblock/BLAPI", "bugs": { diff --git a/src/main.ts b/src/main.ts index 3fb444f..87c0355 100644 --- a/src/main.ts +++ b/src/main.ts @@ -64,7 +64,7 @@ type DiscordJSClientFallback = { [k: string]: any; }; -type LogOptions = boolean | { extended?: boolean; logger?: UserLogger }; +type LogOptions = { extended?: boolean; logger?: UserLogger }; let listData = fallbackData as listDataType; let legacyIds = legacyIdsFallbackData as legacyIdDataType; @@ -432,14 +432,8 @@ export async function manualPost( } export function setLogging(logOptions: LogOptions): void { - // we are setting extendedLogging to the passed in logOptions - // so users can disable extended logging later on - if (typeof logOptions === 'boolean') { - extendedLogging = logOptions; - } if ( - typeof logOptions === 'object' - && Object.prototype.hasOwnProperty.call(logOptions, 'extended') + Object.prototype.hasOwnProperty.call(logOptions, 'extended') && typeof logOptions.extended === 'boolean' ) { extendedLogging = logOptions.extended; @@ -448,7 +442,7 @@ export function setLogging(logOptions: LogOptions): void { if (!Object.prototype.hasOwnProperty.call(logOptions, 'logger')) { return; } - const { logger } = logOptions as any; // we checked that it exists beforehand + const logger = logOptions.logger!; // we checked that it exists beforehand // making sure the logger supplied by the user has our required log levels (info, warn, error) if ( typeof logger.info !== 'function' @@ -459,7 +453,6 @@ export function setLogging(logOptions: LogOptions): void { '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()', ); } - // @ts-ignore userLogger = logOptions.logger; }