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

Make ILogger Parameter Optional on AprsIsClient #127

Open
3 tasks
CBielstein opened this issue Apr 22, 2022 · 0 comments
Open
3 tasks

Make ILogger Parameter Optional on AprsIsClient #127

CBielstein opened this issue Apr 22, 2022 · 0 comments
Labels
code cleanliness Refactors, static analysis, etc. good first issue Good for newcomers

Comments

@CBielstein
Copy link
Owner

Description

Currently, AprsIsClient requires an ILogger parameter. This is extremely useful for additional information output (and logging when used in web servers). However, that makes the code slightly more difficult to call for new developers or in situations where a logger is not needed.

To help ease development, we should make the logger parameter to AprsIsClient's constructor optional (nullable, default to null) and do one of the following if the parameter is not supplied:

  1. Set the logger in the client to null and ensure all invocations of it use conditional dereference (e.g. (logger?.LogInformation(...);)
  2. Set a non-null logger of NullLogger class like in the unit tests, then it will log to nowhere

I suspect the first option is probably the best option as a null value clearly indicates the intent of not having a logger.

Acceptance Criteria

  • Make the logger parameter on AprsIsClient nullable and optional (default to null)
  • Update code inside the AprsIsClient to handle that as appropriate (see options above)
  • Update unit tests to simply not specify a logger instead of passing a null logger. Ensure at least one test invokes without and at least one with a logger to ensure both construction methods work
@CBielstein CBielstein added code cleanliness Refactors, static analysis, etc. good first issue Good for newcomers labels Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code cleanliness Refactors, static analysis, etc. good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant