Re: How to implement logging for an imported module?

2021-03-15 Thread Peter Otten
On 15/03/2021 09:47, Robert Latest via Python-list wrote: Richard Damon wrote: On 3/8/21 4:16 AM, Robert Latest via Python-list wrote: Joseph L. Casale wrote: I couldn't find any information on how to implement logging in a library that doesn't know the name of the application that uses it.

Re: How to implement logging for an imported module?

2021-03-15 Thread Robert Latest via Python-list
Richard Damon wrote: > On 3/8/21 4:16 AM, Robert Latest via Python-list wrote: >> Joseph L. Casale wrote: I couldn't find any information on how to implement logging in a library that doesn't know the name of the application that uses it. How is that done? >>> That's not how it

Re: How to implement logging for an imported module?

2021-03-08 Thread Richard Damon
On 3/8/21 4:16 AM, Robert Latest via Python-list wrote: > Joseph L. Casale wrote: >>> I couldn't find any information on how to implement logging in a library >>> that >>> doesn't know the name of the application that uses it. How is that done? >> That's not how it works, it is the opposite. You

Re: How to implement logging for an imported module?

2021-03-08 Thread Robert Latest via Python-list
Joseph L. Casale wrote: >> I couldn't find any information on how to implement logging in a library that >> doesn't know the name of the application that uses it. How is that done? > > That's not how it works, it is the opposite. You need to know the name of its > logger, and since you imported

Re: How to implement logging for an imported module?

2021-03-07 Thread Pankaj Jangid
"Joseph L. Casale" writes: >> I couldn't find any information on how to implement logging in a >> library that doesn't know the name of the application that uses >> it. How is that done? > Create (get) a root logger (you don't have to use it) and set the > level, and attach a handler to it.

RE: How to implement logging for an imported module?

2021-03-07 Thread Joseph L. Casale
> I couldn't find any information on how to implement logging in a library that > doesn't know the name of the application that uses it. How is that done? Hello, That's not how it works, it is the opposite. You need to know the name of its logger, and since you imported it, you do. Logging is

Re: How to implement logging for an imported module?

2021-03-07 Thread Dieter Maurer
Robert Latest wrote at 2021-3-7 10:21 GMT: >I'm trying to add logging to a module that gets imported by another module. But >I only get it to work right if the imported module knows the name of the >importing module. The example given in the "Logging Cookbook" also rely on this >fact. I have used

How to implement logging for an imported module?

2021-03-07 Thread Robert Latest via Python-list
Hello, I'm trying to add logging to a module that gets imported by another module. But I only get it to work right if the imported module knows the name of the importing module. The example given in the "Logging Cookbook" also rely on this fact.