-
I'd like to add a custom log level (at about 24-25) to use for higher level flow tracing than INFO to make debugging a bit easier. I envision a call like self.py.log.flow(msg) that can be at the beginning of methods for example. Do you have suggestions/examples? |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 3 replies
-
Take a look at the official However, you can create your own loggers to trace the logic in your code.
import logging
LOGGER = logging.getLogger('framework')
LOGGER.setLevel(logging.DEBUG)
LOGGER.debug('Log a DEBUG message')
LOGGER.info('Log an INFO message')
LOGGER.warning('Log a WARNING message')
LOGGER.error('Log an ERROR message')
LOGGER.critical('Log a CRITICAL message')
LOGGER.fatal('Log a FATAL message') |
Beta Was this translation helpful? Give feedback.
-
I’m definitely using the pylenium logger.
The issue is that INFO produces too much information for seeing the flow of the testing code and WARNING none. I want to see the log messages I put in the test methods without the many [STEP] messages (mostly py.get()). Am trying to find a happy medium which, in CI report, can show the testing flow in every run without being overwhelming. (pytest report is too terse and INFO too verbose). Am using RP but issue is the same for the stdout/stderr pass through.
It is simpler if it is possible to just have ‘self.py.log.framework’ work as a level between INFO and WARNING.
Using a different logger looks like it might be workable. I’ll play with that as being nearly as simple and more flexible.
Thanks!
Really appreciate your responsiveness and am very much liking pylenium.
pat
…--
Patrick M Neve
Senior QA Automation Engineer
***@***.******@***.***>
Tel. : +1 510 570 3436
Digital Commons, powered by bepress | Elsevier
2100 Milvia Street, Suite 300, Berkeley, CA 94704
From: Carlos Kidman ***@***.***>
Reply-To: ElSnoMan/pyleniumio ***@***.***>
Date: Monday, July 12, 2021 at 10:47
To: ElSnoMan/pyleniumio ***@***.***>
Cc: "Neve, Patrick (ELS-BKY)" ***@***.***>, Author ***@***.***>
Subject: Re: [ElSnoMan/pyleniumio] Question about adding custom log level (between warning and info) (#203)
*** External email: use caution ***
You can use the logger that is attached to Pylenium:
self.py.log.info('Log an INFO message')
You can also instantiate your own loggers (however many you want) using the example I posted above with the logging package. This provides more granular control.
In Pylenium, we have two loggers:
· One for Pylenium
· One for Report Portal (RP)
That way, if the engineer is using RP as their reporting tool, they automatically get the appropriate logs sent and reported as well.
You might want to log the setup and teardown steps that leverage RESTful APIs. I could see a separate logger for those clients since they are not dependent on Pylenium at all.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FElSnoMan%2Fpyleniumio%2Fdiscussions%2F203%23discussioncomment-994997&data=04%7C01%7Cp.neve%40elsevier.com%7C87f0c6f4b79e4512c04a08d9455d1385%7C9274ee3f94254109a27f9fb15c10675d%7C0%7C0%7C637617088336215112%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=X2zkgo7zuaWNmUZVeHytelrxe4kUWGiZTOVLppyQRrc%3D&reserved=0>, or unsubscribe<https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAA426SG3MPDRURWUB5G2TRLTXMTB5ANCNFSM5AHDW2BA&data=04%7C01%7Cp.neve%40elsevier.com%7C87f0c6f4b79e4512c04a08d9455d1385%7C9274ee3f94254109a27f9fb15c10675d%7C0%7C0%7C637617088336215112%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=zUmvO1ecGw%2Fr0PxM%2BmYahrQ339q3AZhLGft4M3Y4IWw%3D&reserved=0>.
|
Beta Was this translation helpful? Give feedback.
-
@pmneve Here's a solution I'm thinking of for Pylenium's logging:
What do you think? |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Ah.
1. would meet my current need nicely!
(2.) probably not necessary as pylenium messages already contain [STEP] and show <element | driver>.py:<line nbr> for identification as coming from pylenium.
Thanks!!
|
Beta Was this translation helpful? Give feedback.
-
For the moment I've been successful in adding a loglevel between info and warning ("QA", 25) and getting closer to the granularity I need. |
Beta Was this translation helpful? Give feedback.
-
I have updated the Logging Documentation so this is more clear 😄 |
Beta Was this translation helpful? Give feedback.
I have updated the Logging Documentation so this is more clear 😄
https://docs.pylenium.io/guides/logging