Config¶
PySQLXEngine has some settings that can help the developer identify problems and have a better experience when dealing with the application's logs and errors.
You can configure these settings using environment variables or LOG_CONFIG
const to change logs and errors.
Keyword¶
PYSQLX_DEV_MODE
: default(False
) IfTrue
, the PySQLXEngine will be in development mode. In this mode, will show the SQL statements builded with the parameters. (Just for development, the SQL is not sent to the database).PYSQLX_SQL_LOG
: default(False
) IfTrue
, the SQL statements will be printed in the console. This log is available at theINFO
level of thelogging
.PYSQLX_USE_COLOR
: default(False
) IfTrue
, the messages will be printed in color.PYSQLX_ERROR_JSON_FMT
: default(False
) IfTrue
, the error messages will be printed in JSON format.
Set environment variables¶
Set LOG_CONFIG const¶
Config the logger¶
After setting the environment variables or LOG_CONFIG
const, you can configure the logger as you wish.
The PySQLXEngine logger is available at root logger.
Running the code¶
Running the code using the terminal
Output