Skip to content

Commit

Permalink
chore: add logging link to errors (#1322)
Browse files Browse the repository at this point in the history
Co-authored-by: Tam <[email protected]>
  • Loading branch information
Shinjice and Tam authored Aug 27, 2024
1 parent ac43a7a commit f317430
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .changeset/seven-dolphins-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': patch
---

Added link to logging documentation inside all of the warnings and errors that refer to verbosity.
3 changes: 2 additions & 1 deletion __integration__/__snapshots__/nameCollisions.test.snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ snapshots["integration name collisions should warn users of name collisions for
`⚠️ __integration__/build/variables.css
While building variables.css, token collisions were found; output may be unexpected. Ignore this warning if intentional.
Use log.verbosity "verbose" or use CLI option --verbose for more details.`;
Use log.verbosity "verbose" or use CLI option --verbose for more details.
Refer to: https://styledictionary.com/reference/logging/`;
/* end snapshot integration name collisions should warn users of name collisions for flat files, brief version */

3 changes: 2 additions & 1 deletion __integration__/__snapshots__/outputReferences.test.snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ snapshots["integration output references should warn the user if filters out ref
`⚠️ __integration__/build/filteredVariables.css
While building filteredVariables.css, filtered out token references were found; output may be unexpected. Ignore this warning if intentional.
Use log.verbosity "verbose" or use CLI option --verbose for more details.`;
Use log.verbosity "verbose" or use CLI option --verbose for more details.
Refer to: https://styledictionary.com/reference/logging/`;
/* end snapshot integration output references should warn the user if filters out references briefly */

snapshots["integration output references should warn the user if filters out references with a detailed message when using verbose logging"] =
Expand Down
6 changes: 4 additions & 2 deletions __integration__/logging/__snapshots__/config.test.snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ export const snapshots = {};
snapshots["integration > logging > config > property value collisions should not throw, but notify users by default"] =
`
Token collisions detected (16):
Use log.verbosity "verbose" or use CLI option --verbose for more details.`;
Use log.verbosity "verbose" or use CLI option --verbose for more details.
Refer to: https://styledictionary.com/reference/logging/`;
/* end snapshot integration > logging > config > property value collisions should not throw, but notify users by default */

snapshots["integration > logging > config > property value collisions should not show warnings if given higher log level"] =
`
Token collisions detected (16):
Use log.verbosity "verbose" or use CLI option --verbose for more details.`;
Use log.verbosity "verbose" or use CLI option --verbose for more details.
Refer to: https://styledictionary.com/reference/logging/`;
/* end snapshot integration > logging > config > property value collisions should not show warnings if given higher log level */

18 changes: 12 additions & 6 deletions __integration__/logging/__snapshots__/file.test.snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,24 @@ css
⚠️ __integration__/build/nameCollisions.css
While building nameCollisions.css, token collisions were found; output may be unexpected. Ignore this warning if intentional.
Use log.verbosity "verbose" or use CLI option --verbose for more details.`;
Use log.verbosity "verbose" or use CLI option --verbose for more details.
Refer to: https://styledictionary.com/reference/logging/`;
/* end snapshot integration logging file name collisions should warn users briefly of name collisions by default */

snapshots["integration logging file name collisions should throw a brief error of name collisions with log level set to error"] =
`⚠️ __integration__/build/nameCollisions.css
While building nameCollisions.css, token collisions were found; output may be unexpected. Ignore this warning if intentional.
Use log.verbosity "verbose" or use CLI option --verbose for more details.`;
Use log.verbosity "verbose" or use CLI option --verbose for more details.
Refer to: https://styledictionary.com/reference/logging/`;
/* end snapshot integration logging file name collisions should throw a brief error of name collisions with log level set to error */

snapshots["integration logging file name collisions should throw a brief error of name collisions with log level set to error on platform level"] =
`⚠️ __integration__/build/nameCollisions.css
While building nameCollisions.css, token collisions were found; output may be unexpected. Ignore this warning if intentional.
Use log.verbosity "verbose" or use CLI option --verbose for more details.`;
Use log.verbosity "verbose" or use CLI option --verbose for more details.
Refer to: https://styledictionary.com/reference/logging/`;
/* end snapshot integration logging file name collisions should throw a brief error of name collisions with log level set to error on platform level */

snapshots["integration logging file name collisions should warn user of name collisions with a detailed message through \"verbose\" verbosity"] =
Expand Down Expand Up @@ -392,21 +395,24 @@ css
⚠️ __integration__/build/filteredReferences.css
While building filteredReferences.css, filtered out token references were found; output may be unexpected. Ignore this warning if intentional.
Use log.verbosity "verbose" or use CLI option --verbose for more details.`;
Use log.verbosity "verbose" or use CLI option --verbose for more details.
Refer to: https://styledictionary.com/reference/logging/`;
/* end snapshot integration logging file filtered references should warn users briefly of filtered references by default */

snapshots["integration logging file filtered references should throw a brief error of filtered references with log level set to error"] =
`⚠️ __integration__/build/filteredReferences.css
While building filteredReferences.css, filtered out token references were found; output may be unexpected. Ignore this warning if intentional.
Use log.verbosity "verbose" or use CLI option --verbose for more details.`;
Use log.verbosity "verbose" or use CLI option --verbose for more details.
Refer to: https://styledictionary.com/reference/logging/`;
/* end snapshot integration logging file filtered references should throw a brief error of filtered references with log level set to error */

snapshots["integration logging file filtered references should throw a brief error of filtered references with log level set to error on platform level"] =
`⚠️ __integration__/build/filteredReferences.css
While building filteredReferences.css, filtered out token references were found; output may be unexpected. Ignore this warning if intentional.
Use log.verbosity "verbose" or use CLI option --verbose for more details.`;
Use log.verbosity "verbose" or use CLI option --verbose for more details.
Refer to: https://styledictionary.com/reference/logging/`;
/* end snapshot integration logging file filtered references should throw a brief error of filtered references with log level set to error on platform level */

snapshots["integration logging file filtered references should warn user of filtered references with a detailed message through \"verbose\" verbosity"] =
Expand Down
2 changes: 2 additions & 0 deletions __integration__/logging/__snapshots__/platform.test.snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ snapshots["integration logging platform property reference errors should throw a
Reference Errors:
Some token references (1) could not be found.
Use log.verbosity "verbose" or use CLI option --verbose for more details.
Refer to: https://styledictionary.com/reference/logging/
`;
/* end snapshot integration logging platform property reference errors should throw and notify users of unknown references */

Expand All @@ -31,6 +32,7 @@ snapshots["integration logging platform property reference errors circular refer
Reference Errors:
Some token references (2) could not be found.
Use log.verbosity "verbose" or use CLI option --verbose for more details.
Refer to: https://styledictionary.com/reference/logging/
`;
/* end snapshot integration logging platform property reference errors circular references should throw and notify users */

3 changes: 2 additions & 1 deletion __node_tests__/cliBuild.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ css
⚠️ __tests__/__output/css/vars.css
While building vars.css, token collisions were found; output may be unexpected. Ignore this warning if intentional.
Use log.verbosity "verbose" or use CLI option --verbose for more details.\n`);
Use log.verbosity "verbose" or use CLI option --verbose for more details.
Refer to: https://styledictionary.com/reference/logging/\n`);
});

it('should log verbosely if --verbose is used', () => {
Expand Down
2 changes: 2 additions & 0 deletions __tests__/StyleDictionary.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ Use log.verbosity "verbose" or use CLI option --verbose for more details.
Reference Errors:
Some token references (1) could not be found.
Use log.verbosity "verbose" or use CLI option --verbose for more details.
Refer to: https://styledictionary.com/reference/logging/
`);
});

Expand Down Expand Up @@ -473,6 +474,7 @@ Use log.verbosity "verbose" or use CLI option --verbose for more details.
Reference Errors:
Some token references (1) could not be found.
Use log.verbosity "verbose" or use CLI option --verbose for more details.
Refer to: https://styledictionary.com/reference/logging/
`);

expect(clearSDMeta(transformed)).to.eql({
Expand Down
3 changes: 2 additions & 1 deletion __tests__/__snapshots__/StyleDictionary.test.snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ Collision detected at: size.padding.xxl! Original value: true, New value: true
snapshots["StyleDictionary class collisions should throw a brief error if the collision is in source files and log is set to error and verbosity default"] =
`
Token collisions detected (28):
Use log.verbosity "verbose" or use CLI option --verbose for more details.`;
Use log.verbosity "verbose" or use CLI option --verbose for more details.
Refer to: https://styledictionary.com/reference/logging/`;
/* end snapshot StyleDictionary class collisions should throw a brief error if the collision is in source files and log is set to error and verbosity default */

snapshots["StyleDictionary class formatFile should support asynchronous formats"] =
Expand Down
1 change: 1 addition & 0 deletions __tests__/exportPlatform.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ Use log.verbosity "verbose" or use CLI option --verbose for more details.`;
expect(cleanConsoleOutput(logStub.firstCall.args[0])).to.equal(`
Unknown CSS Font Shorthand properties found for 1 tokens, CSS output for Font values will be missing some typography token properties as a result:
Use log.verbosity "verbose" or use CLI option --verbose for more details.
Refer to: https://styledictionary.com/reference/logging/
`);

sd.log.verbosity = 'verbose';
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/groupMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* and limitations under the License.
*/

export const verbosityInfo = `Use log.verbosity "verbose" or use CLI option --verbose for more details.`;
export const verbosityInfo = `Use log.verbosity "verbose" or use CLI option --verbose for more details.\nRefer to: https://styledictionary.com/reference/logging/`;

export class GroupMessages {
constructor() {
Expand Down

0 comments on commit f317430

Please sign in to comment.