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

Log warning message when Colorable.color uses the fallback color #55

Closed
mpospese opened this issue Mar 21, 2023 · 0 comments · Fixed by #62
Closed

Log warning message when Colorable.color uses the fallback color #55

mpospese opened this issue Mar 21, 2023 · 0 comments · Fixed by #62
Assignees
Labels
enhancement New feature or request

Comments

@mpospese
Copy link
Contributor

Our Colorable protocol helps users load (and unit test) colors from asset catalogs. It provides a fallback color to use in case the named color asset cannot be found. In that case though we should log a warning message.

Refer to the logging in ImageAsset.image and SystemImage.image, except that we should use YCoreUI.colorLogger.

  • Log warning level message from Colorable.color if and only if returning the fallbackColor.
  • Don't log anything if YCoreUI.isLoggingEnabled == false
  • Use YCoreUI.colorLogger
  • Extract the code that builds name from namespace + rawValue into an internal calculateName() method and cover it in unit tests (see ImageAsset.calculateName() and associated unit tests for reference).
  • warning message must contain the full name from calculateName()
  • In ColorableTests try to minimize use of logger. Ideally log only one message before disabling the logging for remainder of failure cases (but re-enable it at end of tests). See ImageAssetTests and SystemImageTests.
  • Keep unit test coverage at 100%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging a pull request may close this issue.

2 participants