From 10b86bf295b1d0e027f7871bec4b3c76b208330a Mon Sep 17 00:00:00 2001 From: Roger Binns Date: Mon, 15 May 2023 16:24:56 -0700 Subject: [PATCH] You can now change the log handler at any time --- doc/tips.rst | 10 +--------- example-code.py | 3 +-- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/doc/tips.rst b/doc/tips.rst index 8b662e8a..7623b867 100644 --- a/doc/tips.rst +++ b/doc/tips.rst @@ -156,8 +156,7 @@ APSW/SQLite was operating on. SQLite has a `warning/error logging facility `__. You can call :meth:`apsw.ext.log_sqlite` which installs a handler that forwards -SQLite messages to the `logging module -`__. +SQLite messages to the :mod:`logging module `.` To do it yourself:: @@ -168,13 +167,6 @@ To do it yourself:: apsw.config(apsw.SQLITE_CONFIG_LOG, handler) -.. note:: - - The handler **must** be set before any other calls to SQLite. - Once SQLite is initialised you cannot change the logger - a - :exc:`MisuseError` will happen (this restriction is in SQLite not - APSW). - This is an example of what gets printed when I use ``/dev/null`` as the database name in the :class:`Connection` and then tried to create a table. diff --git a/example-code.py b/example-code.py index 4b78e828..67e8accf 100644 --- a/example-code.py +++ b/example-code.py @@ -34,8 +34,7 @@ ### logging: Logging # It is a good idea to get SQLite's logs as you will get more -# information about errors. This has to be done first (a SQLite -# limitation, not APSW). :meth:`apsw.ext.log_sqlite` forwards +# information about errors. :meth:`apsw.ext.log_sqlite` forwards # SQLite's log messages to the :mod:`logging` module. apsw.ext.log_sqlite()