Log & Error Handling
Логування
By default, Casbin uses the built-in log package to print messages to the console:
2017/07/15 19:43:56 [Request: alice, data1, read ---> true]
Logging is disabled by default. Enable it using Enforcer.EnableLog() or the last parameter of NewEnforcer().
For Golang: Casbin supports logging models, enforcement requests, roles, and policies. You can implement custom loggers for Casbin.
For Python: PyCasbin uses Python's standard logging mechanism. PyCasbin calls logging.getLogger() to configure its logger. No special configuration is needed beyond initializing logging in your application. If you don't initialize logging, PyCasbin will produce no log output. When enabling logs in PyCasbin, you can specify configuration through the logging_config parameter. Without explicit configuration, PyCasbin uses the default log configuration. Django users should consult the Django logging documentation. Other Python users should refer to the Python logging documentation.