Skip to main content

Ananxw Framework - 日志管理器与DI容器基础库

Project description

ananxw_framework

Ananxw Framework - 轻量级日志管理器与DI容器基础库

特性

日志管理器 (AAXWLoggerManager)

  • 彩色控制台输出
  • 支持模块级别、类级别日志器
  • JSON 内容格式化过滤器
  • 文件日志轮转支持

依赖注入容器 (AAXWDependencyContainer)

  • 支持多种注入语法 (Spring / Python / Angular 风格)
  • 单例与非单例模式
  • 生命周期管理 (postConstruct / preDestroy)
  • 循环依赖检测

安装

pip install ananxw_framework

快速开始

日志管理器

from ananxw_framework import AAXW_LOG_MGR, AAXWLoggerManager

# 使用默认日志管理器
logger = AAXW_LOG_MGR.getLogger(__name__)
logger.info("Hello World")

# 或创建独立实例
logMgr = AAXWLoggerManager()
logger = logMgr.getLogger("myapp")

依赖注入容器

from ananxw_framework import AAXWDependencyContainer

container = AAXWDependencyContainer()

# 注册服务
@container.register('userService', isSingleton=True)
class UserService:
    def __init__(self):
        self.users = []

# 注册带依赖的服务
@container.register('userController',
    userService='userService',    # 服务引用
    port='int:8080',            # 值注入
)
class UserController:
    def __init__(self):
        self.userService = None
        self.port = None

# 获取服务
controller = container.getAANode('userController')

依赖

  • Python >= 3.8
  • colorlog >= 6.0.0

许可证

Apache License 2.0 - 查看 LICENSE 文件

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ananxw_framework-0.3.0.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ananxw_framework-0.3.0-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

Details for the file ananxw_framework-0.3.0.tar.gz.

File metadata

  • Download URL: ananxw_framework-0.3.0.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for ananxw_framework-0.3.0.tar.gz
Algorithm Hash digest
SHA256 2f885cb8f0567937a59adbf81cfa65d98b7ada364ad170abdc6cac4ee0bee46f
MD5 ce01b1c6728ff5f1581c25c5ffda7d8f
BLAKE2b-256 7777873e66064c3b922481487f1c93e821b803af3cff087dad6312bd160e1b1d

See more details on using hashes here.

File details

Details for the file ananxw_framework-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ananxw_framework-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a1a939b36055e0081291965b5644caac06ede34a6675920b352457cfe32d1df7
MD5 7f0d42a9aceaf38fc5c3e1b7e415e9c4
BLAKE2b-256 a0c000205369b273d1b1c434607095901f65c6125c1f170e1c3baa6cc53f50f6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page