Open vamshiaruru-virgodesigns opened 1 year ago
Thanks for reporting this! Indeed, it seems the method was forgotten to be implemented. Cannot remember what I though when I wrote that piece of docs.
Rocketry simply extends the logging library and basically you just need a redbird.logging.RepoHandler
in the logger called rocketry.task
:
import logging
from redbird.repos import CSVFileRepo
from rocketry.log import LogRecord
from redbird.logging import RepoHandler
repo = CSVFileRepo(model=LogRecord, filename="tasks.csv")
repo.create()
task_logger = logging.getLogger("rocketry.task")
task_logger.handlers.insert(0, RepoHandler(repo=repo))
Put this somewhere before starting the app. Note that I used insert to make sure this is the first RepoHandler as the first repo handler is used for read and write from task logs. You can add other handlers as well as you wish.
I'll revisit this on the weekend.
Thank you for your help and quick reply. I just tried it out and it works!
Ye, it seems I meant to merge this to master before creating the latest version: https://github.com/Miksus/rocketry/pull/88
It seems I forgot (and still have some timezone issues with the new tests (my time zone is different than CI's)). It seems I changed them in the docs before doing this.
So I'll fix the PR soon and merge it and then this issue should be fixed as well.
Doing the same for MongoRepo
fails.
Describe the bug I was going through the documentation here: https://rocketry.readthedocs.io/en/stable/cookbook/robust_applications.html?highlight=email#to-csv , and following the steps to add a repo to an app session, I get the error:
To Reproduce This simple scripts will produce the error:
Expected behavior The repo is set without any errors
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context What else can I do to set the repo in the meantime?