Skip to content

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

Closed
@mpospese

Description

@mpospese

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%

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions