Zoynels commented on code in PR #39700:
URL: https://github.com/apache/airflow/pull/39700#discussion_r1605767021
##########
airflow/config_templates/config.yml:
##########
@@ -810,6 +810,20 @@ logging:
type: string
example: ~
default: "[%%(asctime)s] {{%%(filename)s:%%(lineno)d}} %%(levelname)s -
%%(message)s"
+ log_format_re_pattern:
+ description: |
Review Comment:
As a default pattern for log is: "[%%(asctime)s]
{{%%(filename)s:%%(lineno)d}} %%(levelname)s - %%(message)s"
ChatGPT hepled and then I try with:
* https://regex101.com/r/tK8tLJ/1 - to split
* https://regex101.com/r/tK8tLJ/2 - to match
`(?<=\n)` - find before \n and where next [date]
`(?=` - what patter we should find to split
`(?:|[ \t]+?)` in tests where chould be som spaces before date (it is not
the default pattern), but I want prepare more universal pattern.
`(?:\[.+?\])` -- detect [%%(asctime)s]
`(?:{.+?:[0-9]+})` -- detect {%%(filename)s:%%(lineno)d} -
`(?:CRITICAL|ERROR|WARNING|INFO|DEBUG)` - detect %%(levelname)s
`(?:.+?)` - and message
`(?:\n|$)`) - stops
when use re.split() - the symbols `(?:` do not incdule, because all bracet
includes as split pattern
After some thinking I simplify it to: `(?<=\n)(?=\[.+?\] {.+?:[0-9]+} \w+ -
.*?)`
But then we need remove prefix spaces or with such pattern spaces before
https://github.com/apache/airflow/blob/7fec562987b9ed8b847f8bb80e316b016d4b309d/tests/utils/test_log_handlers.py#L742-L760
or `(?<=\n)(?=[ \t]*?\[.+?\] {.+?:[0-9]+} \w+ - .*?)` then no changes
https://regex101.com/r/tK8tLJ/3
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]