Skip to content

Commit a38e4b0

Browse files
author
LeTeddy
committed
feat: modify logging usage desc for casbin and pyCasbin
1 parent f9aeef2 commit a38e4b0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/LogError.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ Casbin uses the built-in `log` to print logs to the console by default, like:
1414
2017/07/15 19:43:56 [Request: alice, data1, read ---> true]
1515
```
1616

17-
Logging is not enabled by default. You can toggle it via `Enforcer.EnableLog()` or the last parameter of `NewEnforcer()`.
17+
Logging is not enabled by default.
1818

1919
:::note
2020

21-
We already support logging the model, enforce request, role, and policy in Golang. You can define your own log for logging Casbin.
22-
If you are using Python, pycasbin leverages the default Python logging mechanism. The pycasbin package makes a call to `logging.getLogger()` to set the logger. No special logging configuration is needed other than initializing the logger in the parent application. If no logging is initialized within the parent application, you will not see any log messages from pycasbin. At the same time, when you enable log in pycasbin, it will use the [default log configuration](https://github.com/casbin/pycasbin/blob/c33cabfa0ac65cd09cf812a65e71794d64cb5132/casbin/util/log.py#L6C1-L6C1). For other pycasbin extensions, you can refer to the [Django logging docs](https://docs.djangoproject.com/en/4.2/topics/logging/) if you are a Django user. For other Python users, you should refer to the [Python logging docs](https://docs.python.org/3/library/logging.config.html) to configure the logger.
21+
For Golang: We already support logging the model, enforce request, role, and policy in Golang. You can define your own log for logging Casbin.You can toggle it via `Enforcer.EnableLog()` or the last parameter of `NewEnforcer()`. 
22+
For Python: pycasbin leverages the default Python logging mechanism. The pycasbin package makes a call to `logging.getLogger()` to set the logger. No special logging configuration is needed other than initializing the logger in the parent application. If no logging is initialized within the parent application, you will not see any log messages from pycasbin. At the same time, When you enable log in pycasbin, you can specify the logging configuration through the parameter `logging_config`. If no configuration is specified, it will use the [default log configuration](https://github.com/casbin/pycasbin/blob/c33cabfa0ac65cd09cf812a65e71794d64cb5132/casbin/util/log.py#L6C1-L6C1). For other pycasbin extensions, you can refer to the [Django logging docs](https://docs.djangoproject.com/en/4.2/topics/logging/) if you are a Django user. For other Python users, you should refer to the [Python logging docs](https://docs.python.org/3/library/logging.config.html) to configure the logger.
2323
:::
2424

2525
### Use different loggers for different enforcers

0 commit comments

Comments
 (0)