Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve code repetition #1

Merged
merged 4 commits into from
Jan 29, 2025
Merged

Improve code repetition #1

merged 4 commits into from
Jan 29, 2025

Conversation

wlsnmrk
Copy link
Contributor

@wlsnmrk wlsnmrk commented Jan 29, 2025

Substantial amounts of code repetition were present in various ILog types provided by the package. This change provides one Log type implementing ILog and moves responsibility for directing messages to different outputs to the ILogWriter types (Console, Trace, and File), reducing code repetition. Additionally, responsibility for formatting stack trace messages is moved to ILogFormatter. Tests and readme are adjusted accordingly.

Additionally, the ILogWriter implementations are marked as excluded from code coverage, as they are, for the most part:

  1. very simple
  2. untestable (e.g., writing to Console does not admit of unit testing)

* Trace, Console no longer singletons since Trace
  and Console are thread-safe by default
* Responsibility for formatting stack traces
  moved to ILogFormatter
* Added an ILog method for stack traces with
  contextual messages so they will be written
  together
* Marked writers as excluded from coverage since
  they're largely untestable
* Updated readme with latest
@wlsnmrk wlsnmrk merged commit c6c74b6 into main Jan 29, 2025
6 checks passed
@wlsnmrk wlsnmrk deleted the dry-logs branch January 29, 2025 19:59
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