From c08eeec0338d132a61b7e3546a9feb5fe7dab7c0 Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Tue, 13 Oct 2020 14:45:16 -0400 Subject: [PATCH] Updated Development_LogCapture (markdown) --- Development_LogCapture.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Development_LogCapture.md b/Development_LogCapture.md index 4b4604b..132fdb2 100644 --- a/Development_LogCapture.md +++ b/Development_LogCapture.md @@ -90,3 +90,27 @@ with apprise.LogCapture( ## Class Details - By default if no `level=` is specified, then the log level you set globally in your program is used. + + +### Tricks +Format your logs for HTML: +```python +# The default fmt for LogCapture() is: '%(asctime)s - %(levelname)s - %(message)s' + +# But you can use this to leverage how you want the content formatted; so you can +# build your HTML content in advance here if you like: +fmt = '
  • %(asctime)s' \ + '%(levelname)s:' \ + '

    %(message)s

  • ' + +# Now specify our format (and over-ride the default): +with apprise.LogCapture(level=apprise.logging.WARNING, fmt=fmt) as logs: + apobj.notify("hello world") + + # Wrap logs in `