Skip to content

Conversation

@ancientlaw0
Copy link
Contributor

@ancientlaw0 ancientlaw0 commented Jul 21, 2025

Fixes #200

Summary

This PR fixes a bug in utils/log.py where the Tamga logger was being initialized using outdated parameter names (logToFile, logToConsole, and logFile). These parameters are invalid in the currently required tamga>=1.2.0 version as defined in pyproject.toml.

The application was throwing:
TypeError: Tamga.init() got an unexpected keyword argument 'logToFile'

This is due to a mismatch between the expected arguments in Tamga v1.4.0 and the ones used in the project.


What Was Changed

Old initialization (invalid):

Log = Tamga(
    logToFile=Settings.LOG_TO_FILE,
    logToConsole=Settings.TAMGA_LOGGER,
    logFile=Settings.LOG_FILE_ROOT,
)

New initialization (valid as per Tamga 1.4.0 docs):

Log = Tamga(
    colored_output=Settings.TAMGA_LOGGER,
    show_time=True,
    show_timezone=True,
    buffer_size=50,
    file_output=Settings.LOG_TO_FILE,
    file_path=Settings.LOG_FILE_ROOT,
)

Why This Fix Matters
This fix makes the app runnable out-of-the-box for anyone installing dependencies via uv or pip, and using the compatible Tamga version (>=1.2.0 as specified). Without this fix, the project throws a TypeError and fails to start.

Summary by CodeRabbit

Summary by CodeRabbit

  • Chores
    • Updated logging configuration parameter names for clarity.
    • Upgraded "tamga" dependency to version 1.4.0 for improved logging support.

@coderabbitai
Copy link

coderabbitai bot commented Jul 21, 2025

Walkthrough

The initialization of the Log object in app/utils/log.py was updated by renaming the parameters to match the new Tamga logger API. Additionally, the required Tamga version in app/pyproject.toml was bumped from 1.2.0 to 1.4.0 to reflect compatibility with the updated parameter names.

Changes

File(s) Change Summary
app/utils/log.py Renamed Tamga initialization parameters: logToFilefile_output, logToConsoleconsole_output, logFilefile_path.
app/pyproject.toml Updated Tamga dependency version requirement from tamga>=1.2.0 to tamga>=1.4.0.

Estimated code review effort

2 (~15 minutes)

Possibly related issues

Poem

A rabbit hopped to tweak the log,
New names to fit the latest cog,
From file to console, paths aligned,
Tamga’s version now refined.
With every hop, the code runs bright,
Logging smooth, just right tonight! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2828e32 and 463b644.

📒 Files selected for processing (2)
  • app/pyproject.toml (1 hunks)
  • app/utils/log.py (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • app/pyproject.toml
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/utils/log.py
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 974af5b and 4e80cb2.

⛔ Files ignored due to path filters (4)
  • app/db/analytics.db is excluded by !**/*.db
  • app/db/comments.db is excluded by !**/*.db
  • app/db/posts.db is excluded by !**/*.db
  • app/db/users.db is excluded by !**/*.db
📒 Files selected for processing (1)
  • app/utils/log.py (1 hunks)

@ancientlaw0 ancientlaw0 force-pushed the fix/tamga-init-params branch from 4e80cb2 to 2828e32 Compare July 21, 2025 16:48
@DogukanUrker
Copy link
Owner

Nice catch @ancientlaw0! We already handled this in #199, but since that’s taking a while to merge, we can go ahead with this one to avoid errors on main. Your PR has a few small issues and some unnecessary configs though, so I’ll refactor and merge it in. Thanks again!

Bumped Tamga package version to 1.4.0 in pyproject.toml. Updated log.py to use 'console_output' instead of 'colored_output' and removed unused Tamga parameters for improved compatibility with the new version.
@DogukanUrker DogukanUrker self-requested a review July 21, 2025 18:10
Copy link
Owner

@DogukanUrker DogukanUrker left a comment

Choose a reason for hiding this comment

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

lgtm

@DogukanUrker DogukanUrker merged commit 5d6df8c into DogukanUrker:main Jul 21, 2025
2 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in @DogukanUrker's flaskBlog Jul 21, 2025
@ancientlaw0 ancientlaw0 deleted the fix/tamga-init-params branch July 21, 2025 19:01
@ancientlaw0
Copy link
Contributor Author

Thanks for merging! I noticed you updated the Tamga version and tweaked the config — makes perfect sense. I’ll make sure to align dependencies properly and double-check compatibility in future PRs.

@DogukanUrker
Copy link
Owner

No problem! Really appreciate your effort, and I’d love to see more PRs from you in the future. Thanks again! 🚀🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Development

Successfully merging this pull request may close these issues.

Tamga initialization in log.py uses outdated keyword arguments incompatible with v1.4.0

2 participants