Skip to content

feat(logging): add LogManager.extend() for custom driver registration#36

Merged
anilcancakir merged 2 commits intomasterfrom
feat/custom-log-drivers
Apr 5, 2026
Merged

feat(logging): add LogManager.extend() for custom driver registration#36
anilcancakir merged 2 commits intomasterfrom
feat/custom-log-drivers

Conversation

@anilcancakir
Copy link
Copy Markdown
Contributor

Closes #33

Summary

  • Add LogManager.extend(name, factory) for custom LoggerDriver registration
  • Custom drivers checked before built-in switch in _resolveChannel()
  • Custom drivers can override built-ins and be included in stack channels
  • LogManager.resetDrivers() for test cleanup (static registry)
  • Follows same extend() pattern as AuthManager.extend()

Usage

// In ServiceProvider boot()
LogManager.extend('sentry', (config) => SentryLoggerDriver(
  minLevel: config['level'] ?? 'warning',
));

Test plan

  • extend() registers custom driver factory
  • Custom driver receives channel config map
  • Custom driver overrides built-in (e.g., 'console')
  • Stack driver includes custom channels
  • Full test suite: 700 tests pass
  • dart analyze: zero warnings

Copilot AI review requested due to automatic review settings April 5, 2026 19:03
@sentry
Copy link
Copy Markdown

sentry bot commented Apr 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds extension points to the Magic framework’s logging and networking subsystems, enabling app-level customization (custom LoggerDriver registration and direct Dio configuration) while keeping config-driven resolution intact.

Changes:

  • Add LogManager.extend() (static registry) to register custom LoggerDriver factories, resolved before built-in drivers.
  • Add DioNetworkDriver.configureDriver() to expose the underlying Dio instance for SDK/plugin integration.
  • Add tests + docs + changelog entries covering both extension hooks.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
lib/src/logging/log_manager.dart Adds static custom-driver registry (extend/resetDrivers) and resolves custom drivers before built-ins.
lib/src/network/drivers/dio_network_driver.dart Adds configureDriver() hook to mutate the underlying Dio instance.
test/logging/logging_test.dart Adds coverage for LogManager.extend() behavior (config passed, overrides built-ins, stack inclusion).
test/network/network_test.dart Adds coverage for DioNetworkDriver.configureDriver() invocation behavior.
doc/digging-deeper/logging.md Updates custom driver registration docs to use LogManager.extend().
doc/basics/http-client.md Documents the new configureDriver() plugin hook usage.
skills/magic-framework/references/secondary-systems.md Adds reference docs for custom log drivers + example config.
skills/magic-framework/references/http-network.md Adds reference docs for the Dio driver plugin hook.
CHANGELOG.md Records both features under Unreleased.

anilcancakir added a commit that referenced this pull request Apr 5, 2026
…cy (#36)

AuthManager.extend() is an instance method accessed via the facade,
not a static call. Updated docs and skill references to match.
…#33)

Enables custom LoggerDriver registration via static extend() pattern
(mirrors AuthManager.extend). Custom drivers checked before built-in
switch in _resolveChannel(), config-driven resolution with override
support. Includes resetDrivers() for test cleanup.
…cy (#36)

AuthManager.extend() is an instance method accessed via the facade,
not a static call. Updated docs and skill references to match.
@anilcancakir anilcancakir force-pushed the feat/custom-log-drivers branch from 5f9691e to 8b3d699 Compare April 5, 2026 19:11
@anilcancakir anilcancakir merged commit 6ba8993 into master Apr 5, 2026
2 checks passed
@anilcancakir anilcancakir mentioned this pull request Apr 5, 2026
4 tasks
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.

Support custom LoggerDriver registration in LogManager

2 participants