aury-boot 0.0.33__tar.gz → 0.0.35__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {aury_boot-0.0.33 → aury_boot-0.0.35}/PKG-INFO +1 -1
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/_version.py +2 -2
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/app/base.py +4 -10
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/config/settings.py +0 -8
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/scheduler.py +6 -3
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/generate/repository.py.tpl +3 -2
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/aury_docs/02-repository.md.tpl +36 -23
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/main.py.tpl +5 -3
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/worker.py +6 -3
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/common/logging/__init__.py +2 -4
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/common/logging/setup.py +51 -50
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/domain/pagination/__init__.py +68 -70
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/domain/repository/impl.py +103 -26
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/domain/repository/interface.py +26 -7
- {aury_boot-0.0.33 → aury_boot-0.0.35}/.gitignore +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/README.md +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/adapter/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/adapter/base.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/adapter/config.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/adapter/decorators.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/adapter/exceptions.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/adapter/http.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/app/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/app/components.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/app/middlewares.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/app/startup.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/config/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/config/multi_instance.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/constants/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/constants/components.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/constants/scheduler.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/constants/service.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/errors/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/errors/chain.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/errors/codes.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/errors/exceptions.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/errors/handlers.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/errors/response.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/interfaces/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/interfaces/egress.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/interfaces/ingress.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/middleware/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/middleware/logging.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/migrations/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/migrations/manager.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/migrations/setup.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/rpc/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/rpc/base.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/rpc/client.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/rpc/discovery.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/scheduler/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/scheduler/runner.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/application/server/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/add.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/app.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/config.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/docker.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/docs.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/generate.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/init.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/migrate/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/migrate/app.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/migrate/commands.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/pkg.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/server/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/server/app.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/generate/api.py.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/generate/model.py.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/generate/schema.py.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/generate/service.py.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/AGENTS.md.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/README.md.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/admin_console_init.py.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/alert_rules.example.yaml.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/aury_docs/00-overview.md.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/aury_docs/01-model.md.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/aury_docs/03-service.md.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/aury_docs/04-schema.md.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/aury_docs/05-api.md.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/aury_docs/06-exception.md.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/aury_docs/07-cache.md.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/aury_docs/08-scheduler.md.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/aury_docs/09-tasks.md.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/aury_docs/10-storage.md.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/aury_docs/11-logging.md.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/aury_docs/12-admin.md.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/aury_docs/13-channel.md.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/aury_docs/14-mq.md.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/aury_docs/15-events.md.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/aury_docs/16-adapter.md.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/aury_docs/17-alerting.md.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/aury_docs/99-cli.md.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/config.py.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/conftest.py.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/env_templates/_header.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/env_templates/admin.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/env_templates/cache.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/env_templates/database.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/env_templates/log.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/env_templates/messaging.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/env_templates/monitoring.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/env_templates/rpc.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/env_templates/scheduler.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/env_templates/service.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/env_templates/storage.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/env_templates/third_party.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/gitignore.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/modules/api.py.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/modules/exceptions.py.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/modules/schedules.py.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/project/modules/tasks.py.tpl +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/common/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/common/exceptions/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/common/i18n/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/common/i18n/translator.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/common/logging/context.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/common/logging/decorators.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/common/logging/format.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/contrib/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/contrib/admin_console/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/contrib/admin_console/auth.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/contrib/admin_console/discovery.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/contrib/admin_console/install.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/contrib/admin_console/utils.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/domain/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/domain/exceptions/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/domain/models/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/domain/models/base.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/domain/models/mixins.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/domain/models/models.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/domain/repository/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/domain/repository/interceptors.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/domain/repository/query_builder.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/domain/service/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/domain/service/base.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/domain/transaction/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/cache/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/cache/backends.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/cache/base.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/cache/exceptions.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/cache/factory.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/cache/manager.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/channel/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/channel/backends/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/channel/backends/broadcaster.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/channel/base.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/channel/manager.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/clients/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/clients/rabbitmq/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/clients/rabbitmq/config.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/clients/rabbitmq/manager.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/clients/redis/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/clients/redis/config.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/clients/redis/manager.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/database/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/database/config.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/database/exceptions.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/database/manager.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/database/query_tools/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/database/strategies/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/di/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/di/container.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/events/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/events/backends/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/events/backends/broadcaster.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/events/backends/rabbitmq.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/events/base.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/events/manager.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/events/middleware.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/monitoring/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/monitoring/alerting/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/monitoring/alerting/aggregator.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/monitoring/alerting/events.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/monitoring/alerting/manager.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/monitoring/alerting/notifiers/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/monitoring/alerting/notifiers/base.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/monitoring/alerting/notifiers/feishu.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/monitoring/alerting/notifiers/webhook.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/monitoring/alerting/rules.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/monitoring/health/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/monitoring/tracing/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/monitoring/tracing/context.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/monitoring/tracing/logging.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/monitoring/tracing/processor.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/monitoring/tracing/provider.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/monitoring/tracing/tracing.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/mq/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/mq/backends/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/mq/backends/rabbitmq.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/mq/backends/redis.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/mq/base.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/mq/manager.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/scheduler/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/scheduler/exceptions.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/scheduler/manager.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/storage/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/storage/base.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/storage/exceptions.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/storage/factory.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/tasks/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/tasks/config.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/tasks/constants.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/tasks/exceptions.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/infrastructure/tasks/manager.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/testing/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/testing/base.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/testing/client.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/testing/factory.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/toolkit/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/toolkit/http/__init__.py +0 -0
- {aury_boot-0.0.33 → aury_boot-0.0.35}/pyproject.toml +0 -0
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '0.0.
|
|
32
|
-
__version_tuple__ = version_tuple = (0, 0,
|
|
31
|
+
__version__ = version = '0.0.35'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 0, 35)
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
|
@@ -280,7 +280,7 @@ class FoundationApp(FastAPI):
|
|
|
280
280
|
title: str = "Aury Service",
|
|
281
281
|
version: str = "1.0.0",
|
|
282
282
|
description: str | None = None,
|
|
283
|
-
|
|
283
|
+
logger_levels: list[tuple[str, str]] | None = None,
|
|
284
284
|
**kwargs: Any,
|
|
285
285
|
) -> None:
|
|
286
286
|
"""初始化应用。
|
|
@@ -290,9 +290,8 @@ class FoundationApp(FastAPI):
|
|
|
290
290
|
title: 应用标题
|
|
291
291
|
version: 应用版本
|
|
292
292
|
description: 应用描述
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
也可通过配置 LOG__INTERCEPT_LOGGERS 设置。
|
|
293
|
+
logger_levels: 需要设置特定级别的 logger 列表,格式: [("name", "LEVEL"), ...]
|
|
294
|
+
例如: [("sse_starlette", "WARNING"), ("httpx", "INFO")]
|
|
296
295
|
**kwargs: 传递给 FastAPI 的其他参数
|
|
297
296
|
"""
|
|
298
297
|
# 加载配置
|
|
@@ -304,11 +303,6 @@ class FoundationApp(FastAPI):
|
|
|
304
303
|
frame = sys._getframe(1)
|
|
305
304
|
self._caller_module = frame.f_globals.get("__name__", "__main__")
|
|
306
305
|
|
|
307
|
-
# 合并 intercept_loggers:参数 + 配置
|
|
308
|
-
merged_intercept = list(config.log.intercept_loggers)
|
|
309
|
-
if intercept_loggers:
|
|
310
|
-
merged_intercept.extend(intercept_loggers)
|
|
311
|
-
|
|
312
306
|
# 初始化日志(必须在其他操作之前)
|
|
313
307
|
setup_logging(
|
|
314
308
|
log_level=config.log.level,
|
|
@@ -318,7 +312,7 @@ class FoundationApp(FastAPI):
|
|
|
318
312
|
retention_days=config.log.retention_days,
|
|
319
313
|
enable_file_rotation=config.log.enable_file_rotation,
|
|
320
314
|
enable_console=config.log.enable_console,
|
|
321
|
-
|
|
315
|
+
logger_levels=logger_levels,
|
|
322
316
|
)
|
|
323
317
|
|
|
324
318
|
# 注册 access 日志(HTTP 请求日志)
|
|
@@ -401,14 +401,6 @@ class LogSettings(BaseModel):
|
|
|
401
401
|
default=False,
|
|
402
402
|
description="是否记录 WebSocket 消息内容(注意性能和敏感数据)"
|
|
403
403
|
)
|
|
404
|
-
intercept_loggers: list[str] = Field(
|
|
405
|
-
default_factory=list,
|
|
406
|
-
description=(
|
|
407
|
-
"额外需要由 loguru 接管的标准 logging logger 名称列表。"
|
|
408
|
-
"框架默认已拦截 uvicorn、uvicorn.error、uvicorn.access、sqlalchemy.engine,"
|
|
409
|
-
"此处配置会追加到默认列表。"
|
|
410
|
-
),
|
|
411
|
-
)
|
|
412
404
|
|
|
413
405
|
|
|
414
406
|
class ServiceSettings(BaseModel):
|
|
@@ -84,9 +84,12 @@ def run_scheduler(
|
|
|
84
84
|
module = __import__(module_path, fromlist=[app_name])
|
|
85
85
|
application = getattr(module, app_name)
|
|
86
86
|
|
|
87
|
-
#
|
|
88
|
-
from aury.boot.common.logging import
|
|
89
|
-
|
|
87
|
+
# 设置日志(必须在其他操作之前)
|
|
88
|
+
from aury.boot.common.logging import setup_logging
|
|
89
|
+
setup_logging(
|
|
90
|
+
log_level=getattr(application, "_config", None) and application._config.log.level or "INFO",
|
|
91
|
+
service_type="scheduler",
|
|
92
|
+
)
|
|
90
93
|
|
|
91
94
|
# 获取调度器
|
|
92
95
|
from aury.boot.infrastructure.scheduler import SchedulerManager
|
{aury_boot-0.0.33 → aury_boot-0.0.35}/aury/boot/commands/templates/generate/repository.py.tpl
RENAMED
|
@@ -11,8 +11,9 @@ class {class_name}Repository(BaseRepository[{class_name}]):
|
|
|
11
11
|
继承 BaseRepository 自动获得:
|
|
12
12
|
- get(id): 按 ID 获取
|
|
13
13
|
- get_by(**filters): 按条件获取单个
|
|
14
|
-
- list(skip, limit, **filters): 获取列表
|
|
15
|
-
- paginate(
|
|
14
|
+
- list(skip, limit, sort, **filters): 获取列表
|
|
15
|
+
- paginate(pagination, sort, **filters): 分页获取
|
|
16
|
+
- stream(batch_size, sort, **filters): 流式查询
|
|
16
17
|
- create(data): 创建
|
|
17
18
|
- update(entity, data): 更新
|
|
18
19
|
- delete(entity, soft=True): 删除
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
**文件**: `{package_name}/repositories/user_repository.py`
|
|
6
6
|
|
|
7
7
|
```python
|
|
8
|
-
"""User 数据访问层。"""
|
|
8
|
+
"""“User 数据访问层。"""
|
|
9
9
|
|
|
10
10
|
from aury.boot.domain.repository.impl import BaseRepository
|
|
11
11
|
|
|
@@ -18,13 +18,14 @@ class UserRepository(BaseRepository[User]):
|
|
|
18
18
|
继承 BaseRepository 自动获得:
|
|
19
19
|
- get(id): 按 ID 获取
|
|
20
20
|
- get_by(**filters): 按条件获取单个
|
|
21
|
-
- list(skip, limit, **filters): 获取列表
|
|
22
|
-
- paginate(
|
|
21
|
+
- list(skip, limit, sort, **filters): 获取列表
|
|
22
|
+
- paginate(pagination, sort, **filters): 分页获取
|
|
23
23
|
- count(**filters): 计数
|
|
24
24
|
- exists(**filters): 是否存在
|
|
25
25
|
- create(data): 创建
|
|
26
26
|
- update(entity, data): 更新
|
|
27
27
|
- delete(entity, soft=True): 删除(默认软删除)
|
|
28
|
+
- stream(batch_size, sort, **filters): 流式查询
|
|
28
29
|
- batch_create(data_list): 批量创建
|
|
29
30
|
- bulk_insert(data_list): 高性能批量插入
|
|
30
31
|
"""
|
|
@@ -35,7 +36,7 @@ class UserRepository(BaseRepository[User]):
|
|
|
35
36
|
|
|
36
37
|
async def list_active(self, skip: int = 0, limit: int = 100) -> list[User]:
|
|
37
38
|
"""获取激活用户列表。"""
|
|
38
|
-
return await self.list(skip=skip, limit=limit, is_active=True)
|
|
39
|
+
return await self.list(skip=skip, limit=limit, sort="-created_at", is_active=True)
|
|
39
40
|
```
|
|
40
41
|
|
|
41
42
|
## 2.2 BaseRepository 方法详解
|
|
@@ -50,25 +51,36 @@ repo = UserRepository(session, User)
|
|
|
50
51
|
user = await repo.get(user_id) # 按 ID(支持 int/UUID)
|
|
51
52
|
user = await repo.get_by(email="a@b.com") # 按条件(简单 AND 过滤)
|
|
52
53
|
users = await repo.list(skip=0, limit=10) # 列表
|
|
54
|
+
users = await repo.list(sort="-created_at") # 带排序
|
|
53
55
|
users = await repo.list(is_active=True) # 带过滤
|
|
54
56
|
count = await repo.count(is_active=True) # 计数
|
|
55
57
|
exists = await repo.exists(email="a@b.com") # 是否存在
|
|
56
58
|
|
|
57
59
|
# === 分页 ===
|
|
58
|
-
from aury.boot.domain.pagination import PaginationParams
|
|
60
|
+
from aury.boot.domain.pagination import PaginationParams
|
|
59
61
|
|
|
62
|
+
# 方式1: offset/limit(与 SQL 语义一致)
|
|
60
63
|
result = await repo.paginate(
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
pagination=PaginationParams(offset=0, limit=20),
|
|
65
|
+
sort="-created_at",
|
|
66
|
+
is_active=True,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
# 方式2: page/size(UI 风格)
|
|
70
|
+
result = await repo.paginate(
|
|
71
|
+
pagination=PaginationParams.of(page=1, size=20),
|
|
72
|
+
sort="-created_at",
|
|
63
73
|
is_active=True,
|
|
64
74
|
)
|
|
65
75
|
|
|
66
76
|
# PaginationResult 结构:
|
|
67
77
|
# - result.items: list[T] # 数据列表
|
|
68
78
|
# - result.total: int # 总记录数
|
|
69
|
-
# - result.
|
|
70
|
-
# - result.
|
|
71
|
-
# - result.
|
|
79
|
+
# - result.offset: int # 当前偏移量
|
|
80
|
+
# - result.limit: int # 每页数量
|
|
81
|
+
# - result.page: int # 当前页码(计算属性)
|
|
82
|
+
# - result.size: int # limit 别名
|
|
83
|
+
# - result.total_pages: int # 总页数(计算属性)
|
|
72
84
|
# - result.has_next: bool # 是否有下一页
|
|
73
85
|
# - result.has_prev: bool # 是否有上一页
|
|
74
86
|
|
|
@@ -96,11 +108,11 @@ result = await repo.cursor_paginate(
|
|
|
96
108
|
|
|
97
109
|
# === 流式查询(大数据处理) ===
|
|
98
110
|
# 逐条流式处理,不会一次性加载到内存
|
|
99
|
-
async for user in repo.stream(batch_size=1000, is_active=True):
|
|
111
|
+
async for user in repo.stream(batch_size=1000, sort="-created_at", is_active=True):
|
|
100
112
|
await process(user)
|
|
101
113
|
|
|
102
114
|
# 批量流式处理
|
|
103
|
-
async for batch in repo.stream_batches(batch_size=1000):
|
|
115
|
+
async for batch in repo.stream_batches(batch_size=1000, sort="id"):
|
|
104
116
|
await bulk_sync_to_es(batch)
|
|
105
117
|
|
|
106
118
|
# === 创建 ===
|
|
@@ -140,27 +152,28 @@ user = await repo.get_by(status__ne="archived")
|
|
|
140
152
|
|
|
141
153
|
> 注意:filters 条件之间用 AND 组合;如需 AND/OR/NOT 的复杂组合,请使用 `QueryBuilder`(见 2.4)。
|
|
142
154
|
|
|
143
|
-
### 2.2.2 排序参数(
|
|
155
|
+
### 2.2.2 排序参数(sort)
|
|
144
156
|
|
|
145
|
-
`
|
|
157
|
+
所有查询方法的 `sort` 参数支持多种格式:
|
|
146
158
|
|
|
147
159
|
```python
|
|
148
|
-
|
|
160
|
+
# 字符串(推荐)
|
|
161
|
+
await repo.list(sort="-created_at") # 简洁语法
|
|
162
|
+
await repo.list(sort="-created_at,priority") # 多字段
|
|
163
|
+
await repo.list(sort="created_at:desc,priority:asc") # 完整语法
|
|
149
164
|
|
|
150
|
-
#
|
|
151
|
-
|
|
152
|
-
sort_params = SortParams.from_string("-created_at,priority") # 多字段
|
|
165
|
+
# 字符串列表
|
|
166
|
+
await repo.list(sort=["-created_at", "name"])
|
|
153
167
|
|
|
154
|
-
#
|
|
155
|
-
|
|
168
|
+
# SortParams 对象(需要白名单验证时)
|
|
169
|
+
from aury.boot.domain.pagination import SortParams
|
|
156
170
|
|
|
157
|
-
# 带字段白名单验证(防止 SQL 注入)
|
|
158
171
|
ALLOWED_FIELDS = {{"id", "created_at", "priority", "status"}}
|
|
159
172
|
sort_params = SortParams.from_string(
|
|
160
173
|
"-created_at",
|
|
161
|
-
allowed_fields=ALLOWED_FIELDS
|
|
174
|
+
allowed_fields=ALLOWED_FIELDS # 传入非法字段抛 ValueError
|
|
162
175
|
)
|
|
163
|
-
|
|
176
|
+
await repo.list(sort=sort_params)
|
|
164
177
|
```
|
|
165
178
|
|
|
166
179
|
### 2.2.3 查询全部(limit=None)
|
|
@@ -25,15 +25,17 @@ config = AppConfig()
|
|
|
25
25
|
# - HEALTH_CHECK_PATH: 健康检查路径(默认 /api/health)
|
|
26
26
|
# - HEALTH_CHECK_ENABLED: 是否启用(默认 true)
|
|
27
27
|
#
|
|
28
|
-
#
|
|
29
|
-
#
|
|
28
|
+
# 日志:
|
|
29
|
+
# 框架自动全局接管所有 logging,无需配置
|
|
30
|
+
# 要查看 TRACE 级别日志,设置 LOG__LEVEL=TRACE
|
|
31
|
+
# 要屏蔽某些库的 DEBUG 日志,使用 logger_levels 参数
|
|
30
32
|
#
|
|
31
33
|
app = FoundationApp(
|
|
32
34
|
title="{project_name}",
|
|
33
35
|
version="0.1.0",
|
|
34
36
|
description="{project_name} - 基于 Aury Boot",
|
|
35
37
|
config=config,
|
|
36
|
-
|
|
38
|
+
# logger_levels=[("sse_starlette", "WARNING")], # 可选:设置特定库的日志级别
|
|
37
39
|
)
|
|
38
40
|
|
|
39
41
|
# 注册 API 路由
|
|
@@ -100,9 +100,12 @@ def run_worker(
|
|
|
100
100
|
module = __import__(module_path, fromlist=[app_name])
|
|
101
101
|
application = getattr(module, app_name)
|
|
102
102
|
|
|
103
|
-
#
|
|
104
|
-
from aury.boot.common.logging import
|
|
105
|
-
|
|
103
|
+
# 设置日志(必须在其他操作之前)
|
|
104
|
+
from aury.boot.common.logging import setup_logging
|
|
105
|
+
setup_logging(
|
|
106
|
+
log_level=getattr(application, "_config", None) and application._config.log.level or "INFO",
|
|
107
|
+
service_type="worker",
|
|
108
|
+
)
|
|
106
109
|
|
|
107
110
|
# 尝试导入 dramatiq
|
|
108
111
|
try:
|
|
@@ -41,14 +41,13 @@ from aury.boot.common.logging.format import (
|
|
|
41
41
|
log_exception,
|
|
42
42
|
)
|
|
43
43
|
from aury.boot.common.logging.setup import (
|
|
44
|
-
|
|
44
|
+
TRACE,
|
|
45
45
|
register_log_sink,
|
|
46
|
-
setup_intercept,
|
|
47
46
|
setup_logging,
|
|
48
47
|
)
|
|
49
48
|
|
|
50
49
|
__all__ = [
|
|
51
|
-
"
|
|
50
|
+
"TRACE",
|
|
52
51
|
"ServiceContext",
|
|
53
52
|
"format_exception_java_style",
|
|
54
53
|
"get_class_logger",
|
|
@@ -61,7 +60,6 @@ __all__ = [
|
|
|
61
60
|
"register_log_sink",
|
|
62
61
|
"set_service_context",
|
|
63
62
|
"set_trace_id",
|
|
64
|
-
"setup_intercept",
|
|
65
63
|
"setup_logging",
|
|
66
64
|
]
|
|
67
65
|
|
|
@@ -11,6 +11,25 @@ from typing import Any
|
|
|
11
11
|
|
|
12
12
|
from loguru import logger
|
|
13
13
|
|
|
14
|
+
# =============================================================================
|
|
15
|
+
# TRACE Level 支持
|
|
16
|
+
# =============================================================================
|
|
17
|
+
# 标准 logging 没有 TRACE,需要手动添加
|
|
18
|
+
# TRACE (5) < DEBUG (10),用于超细粒度调试(如每个 streaming chunk)
|
|
19
|
+
TRACE = 5
|
|
20
|
+
logging.addLevelName(TRACE, "TRACE")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _add_trace_method() -> None:
|
|
24
|
+
"""为标准 logging.Logger 添加 trace() 方法。"""
|
|
25
|
+
def trace(self: logging.Logger, msg: str, *args: Any, **kwargs: Any) -> None:
|
|
26
|
+
if self.isEnabledFor(TRACE):
|
|
27
|
+
self._log(TRACE, msg, args, **kwargs)
|
|
28
|
+
|
|
29
|
+
logging.Logger.trace = trace # type: ignore[attr-defined]
|
|
30
|
+
|
|
31
|
+
_add_trace_method()
|
|
32
|
+
|
|
14
33
|
from aury.boot.common.logging.context import (
|
|
15
34
|
ServiceContext,
|
|
16
35
|
_to_service_context,
|
|
@@ -89,31 +108,27 @@ def register_log_sink(
|
|
|
89
108
|
logger.debug(f"注册日志 sink: {name} (filter_key={filter_key})")
|
|
90
109
|
|
|
91
110
|
|
|
92
|
-
# 默认拦截的标准 logging 日志记录器
|
|
93
|
-
# - uvicorn: Uvicorn 服务器日志
|
|
94
|
-
# - uvicorn.error: Uvicorn 错误日志
|
|
95
|
-
# - sqlalchemy.engine: SQLAlchemy SQL 语句日志
|
|
96
|
-
# 注意:uvicorn.access 不拦截,因为框架有自己的 RequestLoggingMiddleware
|
|
97
|
-
DEFAULT_INTERCEPT_LOGGERS = [
|
|
98
|
-
"uvicorn",
|
|
99
|
-
"uvicorn.error",
|
|
100
|
-
"sqlalchemy.engine",
|
|
101
|
-
]
|
|
102
|
-
|
|
103
111
|
|
|
104
112
|
class _InterceptHandler(logging.Handler):
|
|
105
113
|
"""将标准 logging 日志转发到 loguru 的处理器。"""
|
|
106
114
|
|
|
107
115
|
def emit(self, record: logging.LogRecord) -> None:
|
|
108
116
|
# 获取对应的 loguru 级别
|
|
117
|
+
# loguru 原生支持 TRACE,标准 logging 的 TRACE(5) 会自动映射
|
|
109
118
|
try:
|
|
110
119
|
level = logger.level(record.levelname).name
|
|
111
120
|
except ValueError:
|
|
112
121
|
level = record.levelno
|
|
113
122
|
|
|
114
123
|
# 查找调用者的帧深度
|
|
115
|
-
|
|
116
|
-
|
|
124
|
+
# 跳过 logging 模块和本文件的所有帧
|
|
125
|
+
frame = logging.currentframe()
|
|
126
|
+
depth = 0
|
|
127
|
+
while frame is not None:
|
|
128
|
+
filename = frame.f_code.co_filename
|
|
129
|
+
# 跳过 logging 模块、本文件、loguru 内部
|
|
130
|
+
if "logging" not in filename and "loguru" not in filename:
|
|
131
|
+
break
|
|
117
132
|
frame = frame.f_back
|
|
118
133
|
depth += 1
|
|
119
134
|
|
|
@@ -122,35 +137,22 @@ class _InterceptHandler(logging.Handler):
|
|
|
122
137
|
)
|
|
123
138
|
|
|
124
139
|
|
|
125
|
-
def
|
|
126
|
-
"""
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
std_logger.handlers = [handler]
|
|
131
|
-
std_logger.setLevel(logging.DEBUG)
|
|
132
|
-
std_logger.propagate = False
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
def setup_intercept(logger_names: list[str] | None = None) -> None:
|
|
136
|
-
"""拦截标准 logging 日志记录器并转发到 loguru。
|
|
137
|
-
|
|
138
|
-
用于独立脚本/CLI 入口点(不使用 FoundationApp 时)。
|
|
139
|
-
FoundationApp 会自动调用此函数,无需手动调用。
|
|
140
|
-
|
|
140
|
+
def _setup_global_intercept(logger_levels: list[tuple[str, str]] | None = None) -> None:
|
|
141
|
+
"""全局接管所有标准 logging,转发到 loguru。
|
|
142
|
+
|
|
143
|
+
这样任何使用 logging.getLogger() 的库都会自动被接管。
|
|
144
|
+
|
|
141
145
|
Args:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
使用示例::
|
|
146
|
-
|
|
147
|
-
from aury.boot.common.logging import setup_logging, setup_intercept
|
|
148
|
-
|
|
149
|
-
setup_logging(log_level="DEBUG")
|
|
150
|
-
setup_intercept(["my_package", "third_party_lib"])
|
|
146
|
+
logger_levels: 需要设置特定级别的 logger 列表,格式: [("name", "LEVEL"), ...]
|
|
147
|
+
例如: [("sse_starlette", "WARNING"), ("httpx", "INFO")]
|
|
151
148
|
"""
|
|
152
|
-
|
|
153
|
-
|
|
149
|
+
logging.root.handlers = [_InterceptHandler()]
|
|
150
|
+
logging.root.setLevel(TRACE) # 接收所有级别,包括 TRACE
|
|
151
|
+
|
|
152
|
+
# 对指定的 logger 设置特定级别
|
|
153
|
+
if logger_levels:
|
|
154
|
+
for name, level in logger_levels:
|
|
155
|
+
logging.getLogger(name).setLevel(level.upper())
|
|
154
156
|
|
|
155
157
|
|
|
156
158
|
def setup_logging(
|
|
@@ -162,7 +164,7 @@ def setup_logging(
|
|
|
162
164
|
retention_days: int = 7,
|
|
163
165
|
rotation_size: str = "50 MB",
|
|
164
166
|
enable_console: bool = True,
|
|
165
|
-
|
|
167
|
+
logger_levels: list[tuple[str, str]] | None = None,
|
|
166
168
|
) -> None:
|
|
167
169
|
"""设置日志配置。
|
|
168
170
|
|
|
@@ -177,7 +179,7 @@ def setup_logging(
|
|
|
177
179
|
可通过 register_log_sink() 注册额外的日志文件(如 access.log)。
|
|
178
180
|
|
|
179
181
|
Args:
|
|
180
|
-
log_level: 日志级别(DEBUG/INFO/WARNING/ERROR/CRITICAL)
|
|
182
|
+
log_level: 日志级别(DEBUG/INFO/WARNING/ERROR/CRITICAL/TRACE)
|
|
181
183
|
log_dir: 日志目录(默认:./logs)
|
|
182
184
|
service_type: 服务类型(app/scheduler/worker)
|
|
183
185
|
enable_file_rotation: 是否启用日志轮转
|
|
@@ -185,8 +187,8 @@ def setup_logging(
|
|
|
185
187
|
retention_days: 日志保留天数(默认:7 天)
|
|
186
188
|
rotation_size: 单文件大小上限(默认:50 MB)
|
|
187
189
|
enable_console: 是否输出到控制台
|
|
188
|
-
|
|
189
|
-
|
|
190
|
+
logger_levels: 需要设置特定级别的 logger 列表,格式: [("name", "LEVEL"), ...]
|
|
191
|
+
例如: [("sse_starlette", "WARNING"), ("httpx", "INFO")]
|
|
190
192
|
"""
|
|
191
193
|
log_level = log_level.upper()
|
|
192
194
|
log_dir = log_dir or "logs"
|
|
@@ -273,16 +275,15 @@ def setup_logging(
|
|
|
273
275
|
filter=lambda record, c=ctx: record["extra"].get("service") == c,
|
|
274
276
|
)
|
|
275
277
|
|
|
276
|
-
#
|
|
277
|
-
|
|
278
|
-
|
|
278
|
+
# 全局拦截标准 logging 日志并转发到 loguru
|
|
279
|
+
# 所有使用 logging.getLogger() 的库自动被接管
|
|
280
|
+
_setup_global_intercept(logger_levels=logger_levels)
|
|
279
281
|
|
|
280
|
-
logger.info
|
|
282
|
+
logger.info
|
|
281
283
|
|
|
282
284
|
|
|
283
285
|
__all__ = [
|
|
284
|
-
"
|
|
286
|
+
"TRACE",
|
|
285
287
|
"register_log_sink",
|
|
286
|
-
"setup_intercept",
|
|
287
288
|
"setup_logging",
|
|
288
289
|
]
|