refactor(common): replace raw print warning calls with structured logger#218
Conversation
Runtime warning messages in parameter evaluation and initialization callbacks were previously output using raw print() calls, which prevented them from being properly formatted and queried as JSON log entries in Cloud Logging. Summary of Changes: - Replace print() warning in onInit() callback registration with logger.warning(). - Replace 4 print() warnings in Param.value(), SecretParam.runtimeValue(), ListParam.runtimeValue(), and EnumListParam.runtimeValue() with logger.warning(). - Remove redundant 'Warning: ' text prefixes since severity is captured by the logger. - Sort relative import directives alphabetically. Fixes #212
There was a problem hiding this comment.
Code Review
This pull request replaces standard print statements with structured logger.warning calls from the internal logger module across on_init.dart and params.dart. This standardizes warning logs and removes the redundant 'Warning:' prefix from the logged messages. There are no review comments, and I have no feedback to provide.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request replaces standard print statements with structured logging using logger.warning in on_init.dart and params.dart. The reviewer recommends importing the internal logger implementation (../logger/logger.dart) instead of the public API entry point (../../logger.dart) to avoid potential circular dependencies and keep internal details encapsulated.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request replaces standard print statements with structured logger.warning calls across on_init.dart and params.dart. The review feedback points out that in both ListParam and EnumListParam, if the environment variable is successfully parsed as JSON but does not match the expected list-of-strings structure, the code silently returns the default value without logging a warning. The reviewer suggests throwing a FormatException in these scenarios to ensure the warning is properly captured and logged.
- Throw FormatException in ListParam and EnumListParam when environment variable is valid JSON but not a string array, ensuring logger.warning is triggered. - Add unit tests verifying fallback to default values on invalid array structure.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request replaces standard print statements with a logger utility for warnings, abstracts environment variable access using FirebaseEnv, and updates JSON parsing for list parameters. Feedback was provided to avoid throwing a FormatException for control flow when a parsed JSON list is not a string array, suggesting a simpler fall-through approach instead.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request replaces standard print statements with a custom logger for warnings, updates ListParam and EnumListParam to use FirebaseEnv().environment to support environment mocking, and adds unit tests for these parameters. The review feedback highlights an inconsistency where other parameter types (such as SecretParam, StringParam, and IntParam) still access Platform.environment directly, preventing them from being mocked in tests, and suggests refactoring them to use FirebaseEnv().environment as well.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors parameter resolution and initialization warnings to use a centralized FirebaseEnv utility and a dedicated logger instead of directly accessing Platform.environment and using print statements. It also refines error handling during list parameter parsing, corrects a test timeout placement, and introduces comprehensive unit tests for environment mocking. There are no review comments, so I have no feedback to provide.
f0166bb to
a92a446
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors warning logs to use a dedicated logger instead of direct print statements, migrates ListParam and EnumListParam to use FirebaseEnv for environment variable access, and adds comprehensive unit tests for list parameter parsing. Feedback suggests extending the use of FirebaseEnv to Param.value() and SecretParam.runtimeValue() to improve consistency and support better test mocking.
Runtime warning messages in parameter evaluation and initialization callbacks were previously output using raw print() calls, which prevented them from being properly formatted and queried as JSON log entries in Cloud Logging.
Summary of Changes:
Fixes #212