Skip to content

refactor(common): replace raw print warning calls with structured logger#218

Merged
kevmoo merged 4 commits into
mainfrom
i212_logger_warning
Jul 7, 2026
Merged

refactor(common): replace raw print warning calls with structured logger#218
kevmoo merged 4 commits into
mainfrom
i212_logger_warning

Conversation

@kevmoo

@kevmoo kevmoo commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

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

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
@kevmoo
kevmoo requested a review from brianquinlan July 6, 2026 23:41

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@kevmoo

kevmoo commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread lib/src/common/on_init.dart Outdated
Comment thread lib/src/common/params.dart Outdated
@kevmoo

kevmoo commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread lib/src/common/params.dart
Comment thread lib/src/common/params.dart
- 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.
@kevmoo

kevmoo commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread lib/src/common/params.dart
@kevmoo

kevmoo commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread lib/src/common/params.dart
@kevmoo

kevmoo commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@kevmoo

kevmoo commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread lib/src/common/params.dart
Comment thread lib/src/common/params.dart
@kevmoo
kevmoo merged commit 826f192 into main Jul 7, 2026
32 checks passed
@kevmoo
kevmoo deleted the i212_logger_warning branch July 7, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: replace raw print calls with structured logger.warning

2 participants