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

feature: Add logging to wolfram-app-discovery success and error paths + related cleanups #48

Merged
merged 5 commits into from
Feb 3, 2023

Conversation

ConnorGray
Copy link
Collaborator

No description provided.

* Rename ErrorKind::UnexpectedLayout to UnexpectedAppLayout
* Add new ErrorKind::UnexpectedEnvironmentValueLayout
This makes wolfram-app-discovery easier to debug, particular in CI/CD
environments where it can otherwise we somewhat tedious to get
useful debugging output.

There is a loose naming convention for the added logging statements:

  1. "discovery error: ..." -- emitted by every Error::*() constructor function
  2. "discovery failed: ..." -- emitted on error return paths from top-level discovery functions
  3. "discovered in (app|env): ..." -- emitted on success return paths from top-level discovery functions

(1) is commonly but not always a fatal error. For example, when using discover_all(),
    an error discovering one app does not cause the overall discovery of installed apps
    to fail.

(2) is typically a fatal error -- a top-level discovery function was forced to
    return an error because the highest-precedence discovery mechanism found an
    app or resource that produced an error during validation, or all discovery
    mechanisms were exhausted resulting in no discovery.

Note that logging output will NOT be generated unless a `log` crate logger
has been initialized by other code in the binary wolfram-app-discovery is
compiled into.

E.g. for build scripts using wolfram-app-discovery, a prerequisite for logging
output would be a call to e.g. `env_logger::init()` at the beginning of the
build script.
@ConnorGray ConnorGray merged commit 9b1becc into master Feb 3, 2023
@ConnorGray ConnorGray deleted the feature/add-logging branch February 3, 2023 22:42
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