Skip to content

Conversation

@Karanraj-6
Copy link

… with LogLevel Enum:

  • Updated all convenience methods (success, error, warning, info, hint, magic, config, select, link) to pass Enum members instead of .value.
  • Fixed log() method to properly extract emoji using level.value internally, maintaining type-safety.
  • Ensured error messages correctly use level == LogLevel.ERROR for stderr output.
  • Made evaluation progress methods (complete_evaluation, ail_evaluation) consistent with LogLevel Unicode symbols.
  • Overall: all logging and progress updates now reliably display the intended Unicode symbols without AttributeErrors.

@Karanraj-6
Copy link
Author

@cristipufu
I've fixed the issue "Replace emojis with Unicode for console logger #425". All logging methods now use LogLevel Enum correctly, and the bug with .value misuse is resolved. Could you please review and merge? Thanks!

@Karanraj-6 Karanraj-6 force-pushed the emojis-with-unicode-425 branch from be5ad76 to 48c243d Compare September 20, 2025 17:57
SELECT = "👇"
LINK = "🔗"
MAGIC = "✨"
INFO = "\u2139" # ℹ️ (INFORMATION SOURCE)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
INFO = "\u2139" # ℹ️ (INFORMATION SOURCE)
INFO = "" # (INFORMATION SOURCE)

Copy link
Author

Choose a reason for hiding this comment

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

done

@CatalinB7 CatalinB7 added the build:dev Create a dev build from the pr label Sep 30, 2025
@Karanraj-6 Karanraj-6 force-pushed the emojis-with-unicode-425 branch from 48c243d to e4b1582 Compare October 7, 2025 17:28
@radu-mocanu radu-mocanu removed the build:dev Create a dev build from the pr label Oct 10, 2025
Comment on lines 92 to 93
if fg:
formatted_message = f"{emoji} {click.style(message, fg=fg)}" if emoji else click.style(message, fg=fg)
Copy link
Contributor

Choose a reason for hiding this comment

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

we can simplify the logic here:

Suggested change
if fg:
formatted_message = f"{emoji} {click.style(message, fg=fg)}" if emoji else click.style(message, fg=fg)
formatted_message = f"{level.value} " if level.value else ""
formatted_message += click.style(message, fg=fg) if fg else message

Copy link
Author

Choose a reason for hiding this comment

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

Done. updated formatted_message logic as per your suggestion. Thanks @radu-mocanu !

@radu-mocanu
Copy link
Contributor

almost done 👍
please fix the failing tests, and write some unit tests for the ConsoleLogger.
don't forget about formatting :(uv run ruff check . --fix && uv run ruff format)

- Updated all ConsoleLogger convenience methods to pass Enum members instead of .value
- Fixed log() to extract emoji with level.value internally, maintaining type-safety
- Ensured error messages use level == LogLevel.ERROR for stderr
- Made evaluation progress methods consistent with LogLevel Unicode symbols
- Overall: logging and progress updates now reliably display intended Unicode symbols
->latest change:
- Updated ConsoleLogger.error() to use click.get_current_context().exit
  when available and fallback to builtins.exit for reliable behavior
- Ensures proper exit in CLI context while remaining testable with mocks
- Retains previous logging improvements: Unicode symbols, LogLevel consistency, and type-safety
- Simplified formatted_message logic and cleaned up internal log handling
- Updated "info" Unicode to empty string for consistent output
- Added test_console.py coverage for error() exit behavior:
  * Mocked ctx.exit to verify proper invocation
  * Ensures builtins.exit fallback works in test scenarios
- Overall: error logging and exit mechanism now robust, consistent, and fully tested
@Karanraj-6 Karanraj-6 force-pushed the emojis-with-unicode-425 branch from 3a6b753 to 6a49dce Compare October 24, 2025 13:15
@Karanraj-6
Copy link
Author

@radu-mocanu, Thanks for the feedback. I’ve addressed the failing tests and added unit tests in test_console.py for ConsoleLogger, ensuring proper behavior for error() with ctx.exit and fallback to builtins.exit. All tests are passing successfully, confirming the logger’s functionality. Please let me know if you need any further verification or tweaks!

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.

3 participants