amzn / style-dictionary

A build system for creating cross-platform styles.
https://styledictionary.com
Apache License 2.0
3.91k stars 553 forks source link

Add more robust log level #367

Open dbanksdesign opened 4 years ago

dbanksdesign commented 4 years ago

As a user of Style Dictionary, I would like to control the log level of Style Dictionary so that I can limit the amount of content sent to the console.

Currently we do have a log level option on the config, although it is not documented and currently only used in 1 place: https://github.com/amzn/style-dictionary/blob/master/lib/extend.js#L127

I'd like to define this a bit more, but my initial thinking would be to offer log levels of "error", "warning", "info", "none"

twaiiiin commented 4 years ago

It would be really nice indeed.

We are building a design system which uses Style Dictionary. Our build tool uses a custom CLI with various arguments like --quiet or --silent to change the log level. It works fine with our build tasks/jobs but Style Dictionary logs persist. It would be really nice to be able to configure Style Dictionary log level. Sometimes we need it and sometimes we don't.

I wish I could make a pull request for this and contribute, but I'm a beginner with node and npm.

dbanksdesign commented 4 years ago

We will be working on this as part of the next major release, so we will tackle this soon!

Jasperrr91 commented 1 year ago

Any updates on this @dbanksdesign ? Seems like it was picked up for 3.0 but then let go soon after. It's been 2.5 years now and some sort of warning suppression would be nice.

We too are setting up a design system with Style Dictionary and because we dynamically generate our SD configs depending on the input of Figma Tokens config files, I'd prefer to just suppress collision warnings instead of fiddle around with the include config option.

I'd be happy to help out if needed but I don't want to risk starting on something and then seeing it get closed right away.

DarioSoller commented 1 year ago

I am in the exact same use case like @Jasperrr91 ! So big +1 for clean log levels from my side!

Matheun commented 1 year ago

Would also love to see something like this implemented I let SD generate my tokens for each file, multi brand and multi theme.

this results in cli output like the following: vuetify ✔︎ build/styles/components/button/_button.theme.dark.scss

vuetify ✔︎ build/styles/themes/_theme.dark.color.scss

vuetify ✔︎ build/styles/themes/_theme.dark.outline.scss

this is not ideal, would love to see some option to disable certain cli outputs.

blackfalcon commented 1 year ago

Currently working in a project where we are implementing a darkmode series of tokens and using a system of "./src/color/brand.json", "./src/color-darkmode/*.json" whereas I want to only have a token duplicated if it is different and have the base pass through.

This works great, but yes, the conflict logging is causing stress with the team.

Having a way to suppress this would be AWESOME @dbanksdesign

dbanksdesign commented 1 year ago

We are starting to work on v4 right now and this will be part of v4. @blackfalcon you are talking about the 'property value collision' warnings right? You can get around that now by using include and source: https://stackblitz.com/edit/node-8rqmfn?file=sd.config.js,tokens%2Fcolors.json,dark-mode%2Fcolors.json collisions don't get output if it is something from source overriding something from include

blackfalcon commented 1 year ago

@dbanksdesign thanks! That's exactly what I was looking for!