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

Module logger #141

Open
JosePizarro3 opened this issue Sep 30, 2024 · 7 comments
Open

Module logger #141

JosePizarro3 opened this issue Sep 30, 2024 · 7 comments
Assignees
Labels
improvement/fix Improvement or fix of a previous feature question Further information is requested
Milestone

Comments

@JosePizarro3
Copy link
Collaborator

@ladinesa @ndaelman-hu I have a question regarding the logger. Right now, I was passing it as an input of our functions, but I realize this might not be the best practice.

Do you know what is the best way of handling this? Define it in the class or in the modules?

@JosePizarro3 JosePizarro3 added question Further information is requested improvement/fix Improvement or fix of a previous feature labels Sep 30, 2024
@ladinesa
Copy link
Collaborator

the parse function takes in the logger as arg which should be passed on to other functions. i usually make it as class attrb. you can also define it as var in the module in some cases

@ndaelman-hu
Copy link
Collaborator

The only solution is to share the same logger object among functions. That would be either a decorator or a class attribute, as Alvin suggested.
Given our structure, I would use a class decorator that prepends the section name.

@ndaelman-hu
Copy link
Collaborator

Let me first merge my branch before overhauling the schema at this scale, though.

@JosePizarro3
Copy link
Collaborator Author

Ok, I think class attribute is the most consistent one. I will fix it elsewhere later.

@ndaelman-hu
Copy link
Collaborator

Ok, I think class attribute is the most consistent one. I will fix it elsewhere later.

Indeed, and if you apply it as a class decorator, your implementation will be more modular. How you prefer.

@JosePizarro3
Copy link
Collaborator Author

Ok, I think class attribute is the most consistent one. I will fix it elsewhere later.

Indeed, and if you apply it as a class decorator, your implementation will be more modular. How you prefer.

Why a class decorator? I think an input to each class __init__ should be enough, right?

@JosePizarro3 JosePizarro3 self-assigned this Oct 1, 2024
@ndaelman-hu
Copy link
Collaborator

Ok, I think class attribute is the most consistent one. I will fix it elsewhere later.

Indeed, and if you apply it as a class decorator, your implementation will be more modular. How you prefer.

Why a class decorator? I think an input to each class __init__ should be enough, right?

Please don't move it to the __init__ args, that just displaces the issue, rather than solving it.
Instead, you want a function called during (class?) instantiation that reads in the context.
That functions could either be inherited or set as a class decorator to the sections. Either are fine for our usage.

@JFRudzinski JFRudzinski added this to the 1.0.0 milestone Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement/fix Improvement or fix of a previous feature question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants