Skip to content

Comments

Use new Logrus logger#1757

Merged
jeremybeard merged 3 commits intomainfrom
use-new-logger
Dec 17, 2024
Merged

Use new Logrus logger#1757
jeremybeard merged 3 commits intomainfrom
use-new-logger

Conversation

@jeremybeard
Copy link
Contributor

Description

This changes the CLI's use of the Logrus logging library to use a new logger instance instead of reusing the existing global logger instance of the library. This prevents debug logs being suppressed when third-party libraries that the CLI imports change the logging level of the global logger, as is at least the case for the use of the Docker Compose package mid-way through astro dev start.

Note that there are other cases where logs are being suppressed because the root "PersistentPreRunE" function that sets up the logging is overridden by some sub-commands. That issue will be fixed in another PR.

🧪 Functional Testing

  • Debug logs are continuing to print

📋 Checklist

  • Rebased from the main (or release if patching) branch (before testing)
  • Ran make test before taking out of draft
  • Ran make lint before taking out of draft
  • Added/updated applicable tests
  • Tested against Astro-API (if necessary).
  • Tested against Houston-API and Astronomer (if necessary).
  • Communicated to/tagged owners of respective clients potentially impacted by these changes.
  • Updated any related documentation

Copy link
Contributor

@neel-astro neel-astro left a comment

Choose a reason for hiding this comment

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

Thanks for fixing it.
Nit: the logger.Logger wording feels too verbose to use everywhere in the project (not sure why Linter is happy with it 😬😅).

I think either we dot import (not a big fan either 😅 , but don't mind)
Or we could have the log level functions (as public functions) in the cli logger package, with the same function signature as the logrus lib, so that we could directly call logger.Infof (Same as what logrus global log does).
WDYT?

@jeremybeard
Copy link
Contributor Author

@neel-astro Yes, agreed. I like the logger functions idea. I've pushed a commit with that and it looks a lot cleaner.

@jeremybeard jeremybeard mentioned this pull request Dec 17, 2024
8 tasks
Copy link
Contributor

@neel-astro neel-astro left a comment

Choose a reason for hiding this comment

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

Thanks for the cleanup of the logic, this looks much better ❤️

@jeremybeard jeremybeard merged commit 7033012 into main Dec 17, 2024
@jeremybeard jeremybeard deleted the use-new-logger branch December 17, 2024 07:31
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.

2 participants