I like this proposal a lot. Here are my two cents in terms of use cases.

In the C++ side, PyTorch has two logging systems:
- `LOG(LEVEL)`: This is what we familiar with, including DEBUG, INFO, WARNING, 
and FATAL.
- `VLOG(INT_LEVEL)`: This is only for debugging, `INT_LEVEL` could range from 0 
to 10. They use the following way in Python to control the level:
```
from caffe2.python import workspace
workspace.GlobalInit(['caffe2', '--caffe2_log_level=-4'])
```

I personally like the idea of this system because a single level of `DEBUG` is 
too broad. I could imagine that I will get lost in the log sea when executing 
with `DEBUG`. Meanwhile, even we provide 10 levels of debug logging, it is 
still confusing for both developers and debuggers about what level to put and 
what level to set.

Ideally we might combine all good ideas as follows. Note that this is just an 
example.

```
DLOG(FuseOps)(1) << "message"
```

- DLOG stands for "debug log".
- `FuseOps` indicates the log type to differentiate other logs. Note that this 
is also understand a namespace `relay.transform`.
- `1` is the debug log level ranging from 1 to 5.
- This log can be enabled by setting either environment variable or Python 
global logging. In this example, we may use 
`set_debug_log_level("relay.transform.FuseOps", 1)` to enable it.
- Similarity, we may use `set_debug_log_level("relay.transform", 1)` to enable 
all debug logs under a higher level of namespace.

On the Python side, as @leandron pointed out, we should also make it consistent 
as possible. Currently, most Python logging are directly by the global logging 
(i.e., `logging.info("message")`). This would be an issue especially working 
with other Python packages. Specifically, if another Python package with its 
own custom logging, the custom settings might be messed up when importing tvm.





---
[Visit 
Topic](https://discuss.tvm.apache.org/t/rfc-better-tvm-logger-in-c-side/11734/4)
 to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click 
here](https://discuss.tvm.apache.org/email/unsubscribe/ce7431ccb75609f994a736b6cbeaf390e093d37f4e707ea70562dfab1c68fe17).

Reply via email to