Skip to content

Commit

Permalink
log: drop undocumented printYaml config option
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharthvp committed Sep 18, 2023
1 parent 311bcaf commit f06ce4c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 43 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Only breaking changes, deprecations and the like are documented in this change l
- bot.date -> bot.Date
- Class for querying Wikimedia EventStreams have been removed. Consider using the dedicated library [wikimedia-streams](https://www.npmjs.com/package/wikimedia-streams) instead.
- set* methods on MwnDate objects (eg. `setUTCDate`) used to be chainable as they returned `this`. Because MwnDate extends the native Date, the change in return values was not possible to represent in TypeScript types ([Liskov substitution principle](https://en.wikipedia.org/wiki/Liskov_substitution_principle)). This undocumented feature has now been removed for the sake of accurate types.
- `printYaml` logging config option used by is no longer supported in Mwn.setLoggingConfig() method.
- mwn#queryAuthors() which had been deprecated has now been removed. Instead, please use `queryAuthors()` method on page objects.

#### 0.11.0
Expand Down
32 changes: 7 additions & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"chalk": "^1.1.3",
"form-data": "^3.0.0",
"oauth-1.0a": "^2.2.6",
"prettyjson": "^1.1.3",
"tough-cookie": "^4.0.0",
"types-mediawiki": "^1.0.0"
},
Expand Down
20 changes: 3 additions & 17 deletions src/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@

/* eslint-disable @typescript-eslint/no-var-requires */
const chalk = require('chalk');
const prettyjson = require('prettyjson');

export const logConfig = {
printYaml: false,
printDebug: true,
printVerbose: true,
};
Expand Down Expand Up @@ -75,21 +73,9 @@ export function message(msg: item) {
* @param obj
*/
export function debug(obj: item) {
if (logConfig.printYaml) {
// Print YAML
let options = {
keysColor: 'white',
dashColor: 'white',
stringColor: 'yellow',
numberColor: 'blue',
};

console.log(chalk.gray('---\n') + prettyjson.render(obj, options));
} else {
// Print indented JSON
let msg = JSON.stringify(obj, null, 4);
console.log(chalk.gray(msg));
}
// Print indented JSON
let msg = JSON.stringify(obj, null, 4);
console.log(chalk.gray(msg));
}

/**
Expand Down

0 comments on commit f06ce4c

Please sign in to comment.