Skip to content

Conversation

@Sudarshan-21
Copy link

@Sudarshan-21 Sudarshan-21 commented Apr 24, 2025

Fixes issue #102

This PR aims to eliminate the usage of Astropy logging and implement logging using Python's standard logging library.

edit 26/04/2025
As of now, with the current changes, the logging is successfully being done using the standard Python logging module.

Current behaviour can be seen at: HENDRICS/pull/177#issuecomment-2831530914

I need to know the purpose of the commented codes like:

#log.basicConfig(filename='HEN.log', level=log.DEBUG, filemode='w')

in the hendrics/tests/test_a_complete_run.py and similar files, in order to migrate to their new standard logger counterpart.

I would like to hear the inputs and reviews about any missing modifications, or failure of the new logging method.

@matteobachetti @bsipocz @kashish2210 @ankitkhushwaha

@Sudarshan-21
Copy link
Author

Update 25/04/2025

As of now, the import statements of Astropy logging are replaced with the standard Python logging, and the central logger setup is done successfully.
Screenshot from 2025-04-25 22-52-32

The log_to_file attribute from the current code has no direct replacement in the standard Python logging. So, there is a need to create custom functionality to handle those instances.

Screenshot from 2025-04-25 22-52-43

@Sudarshan-21
Copy link
Author

The logging is working fine!!

Screenshot from 2025-04-26 01-38-19

I would like to hear about any changes in the behaviour or missed instances of logging modification, if any.

@Sudarshan-21 Sudarshan-21 marked this pull request as ready for review April 25, 2025 22:30
import logging
import os
from contextlib import contextmanager

Copy link
Member

Choose a reason for hiding this comment

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

You may include good UX like Stingray have you can visit this functions
And then change console_handler (something like this)

console_handler.setFormatter(ColoredFormatter())

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for the suggestion!!
A colored log would be a great enhancement. I would look forward to achieving this, once the current PR gets approval from maintainers.

@kashish2210
Copy link
Member

Hey @Sudarshan-21 this PR looks good start to me:)
I like the implementation of getlogger() it is really good we can also include in stingray cause it's a good enhancement
I have lefted one comment you may refer to that.

@matteobachetti your review required.

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