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

logging not working #224

Open
2 tasks done
maephisto666 opened this issue Nov 17, 2024 · 1 comment
Open
2 tasks done

logging not working #224

maephisto666 opened this issue Nov 17, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@maephisto666
Copy link

maephisto666 commented Nov 17, 2024

Before submitting a bug report...

  • This bug wasn't already reported.
    (I have checked every bug report on GitHub)

  • I've cleared the sessions folder.

Branch

develop

Commit

245d3b1

Describe the bug

I have the feeling logging is not working properly. It only logs WARN and ERROR levels, even if I change the level in the configuration (via source code or configuration file).

From what I have seen

  • first we read the configuration (we import utils.py from main.py and that calls loadConfig)
  • then we initialize the logging configuration (via setupLogging())
  • but while we are reading the configuration there is a logging.info statement that already initializes the logging configuration. So this nullify the effect of setupLogging().

Now.

  • setupLogging() tries to read the configuration (to set the desired level)
  • but (as I said earlier) reading the configuration already initializes the logging module

So I believe this is an undesired "circular" dependency: logging requires configuration, but configuration initializes logging.

@maephisto666 maephisto666 added the bug Something isn't working label Nov 17, 2024
@SteveTryndamere
Copy link

changing logging to print will resolve this issue

def loadConfig(
    configFilename="config.yaml", defaultConfig=DEFAULT_CONFIG
) -> MappingProxyType:
    configFile = getProjectRoot() / configFilename
    try:
        return MappingProxyType(defaultConfig | loadYaml(configFile))
    except OSError:
-        logging.info(f"{configFile} doesn't exist, returning defaults")
+        print(f"{configFile} doesn't exist, returning defaults")
        return defaultConfig

SteveTryndamere added a commit to SteveTryndamere/MS-Rewards-Farmer that referenced this issue Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants