Skip to content

feat: refactor logging architecture to support other log collectors#2

Merged
justprodev merged 7 commits intomainfrom
decompose
Dec 21, 2025
Merged

feat: refactor logging architecture to support other log collectors#2
justprodev merged 7 commits intomainfrom
decompose

Conversation

@justprodev
Copy link
Copy Markdown
Owner

This pull request refactors and modernizes the remote_logging Dart package, expanding its capabilities from Loggly-only support to a more flexible, collector-based architecture for remote logging. It introduces a new abstraction for log collectors, adds support for Splunk, improves tag handling across platforms, and updates the API for easier extensibility and testing. The update also removes legacy code and updates documentation and tests to match the new structure.

Key changes:

Major Architecture and API Changes

  • Introduced the LogCollector abstraction and refactored the logging pipeline to support multiple remote logging services, not just Loggly. The main entrypoint is now initRemoteLogging, which accepts any collector. (lib/src/model.dart [1] lib/src/remote_logging.dart [2] [3] lib/remote_logging.dart [4]
  • Added HttpCollector as a base class for HTTP-based collectors, and implemented both LogglyCollector and new SplunkCollector classes for sending logs to Loggly and Splunk, respectively. (lib/src/remote/collectors/http_collector.dart [1] lib/src/remote/collectors/loggly_collector.dart [2] lib/src/remote/collectors/splunk_collector.dart [3]

Tag Handling and Platform Support

  • Refactored tag handling to use platform-specific default tags via conditional exports, ensuring tags like the OS are automatically included. (lib/src/remote/tags/tags.dart [1] lib/src/remote/tags/impl/io_tags.dart [2] lib/src/remote/tags/impl/empty_tags.dart [3]
  • Updated the tag aggregation logic in the logging pipeline to include log level, platform tags, logger name, and any custom tags. (lib/src/remote_logging.dart lib/src/remote_logging.dartL33-R57)

Deprecation and Cleanup

  • Deprecated the old initLogging API in favor of initRemoteLogging, providing a backward-compatible wrapper for legacy usage. (lib/src/remote_logging.dart lib/src/remote_logging.dartR66-R96)
  • Removed legacy Loggly-specific code and platform tag files, cleaning up the codebase. (lib/src/remote/loggly.dart [1] lib/src/remote/mobile_tags.dart [2]

Documentation and Testing

  • Updated the README.md to reflect the new package name, API, and multi-collector support. (README.md README.mdL1-R15)
  • Added new and updated tests for the new collector architecture and tag handling, and removed tests for deleted legacy code. (test/legacy_remote_logging_test.dart [1] test/loggly_collector_test.dart [2] test/loggly_test.dart [3]

Package Metadata

  • Updated pubspec.yaml to reflect the new version (2.0.0), Dart SDK constraints, and description. (pubspec.yaml pubspec.yamlL2-R7)

@justprodev justprodev merged commit c4280d9 into main Dec 21, 2025
1 check passed
@justprodev justprodev deleted the decompose branch December 21, 2025 01:15
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.

1 participant