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

(chore) throttle deprecation messages #3092

Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
- enh(nginx) improving highlighting of some sections [Josh Goebel][]
- fix(vim) variable names may not be zero length [Josh Goebel][]
- enh(sqf) Updated keywords to Arma 3 v2.02 (#3084) [R3voA3][]
- (chore) throttle deprecation messages (#3092) [Mihkel Eidast][]

New Languages:

- Added 3rd party Splunk search processing language grammar to SUPPORTED_LANGUAGES (#3090) [Wei Su][]
- Added 3rd party Splunk search processing language grammar to SUPPORTED_LANGUAGES (#3090) [Wei Su][]

Theme Improvements:

Expand Down
10 changes: 9 additions & 1 deletion src/lib/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ https://github.com/highlightjs/highlight.js/issues/2880#issuecomment-747275419

*/

/**
* @type {Object.<string, boolean>}
*/
const seenDeprecations = {};

/**
* @param {string} message
*/
Expand Down Expand Up @@ -32,5 +37,8 @@ export const notice = (message) => {
* @param {string} message
*/
export const deprecated = (version, message) => {
console.log(`Deprecated as of ${version}. ${message}`);
if (!seenDeprecations[`${version}-${message}`]) {
console.log(`Deprecated as of ${version}. ${message}`);
seenDeprecations[`${version}-${message}`] = true;
}
};