python-can icon indicating copy to clipboard operation
python-can copied to clipboard

Use can.logger only log received msg to file, but send msg can not logged

Open hongjojjay opened this issue 3 years ago • 6 comments

Describe the bug

I use this below code, only received msg can save to hello.asc file, but send msg can not be saved. How to save the send msg? tmplogger = can.Logger("hello.asc") self.bus.add_listener(tmplogger )

To Reproduce

None

Expected behavior

None

Additional context

OS and version: win10 Python version: 3.7.7 python-can version: 37.0.1 python-can interface/s (if applicable): pcan

hongjojjay avatar Jan 19 '22 08:01 hongjojjay

Most interfaces support the receive_own_messages keyword for that.

zariiii9003 avatar Jan 21 '22 08:01 zariiii9003

However, pcan does not seem to have that: https://python-can.readthedocs.io/en/develop/interfaces/pcan.html#bus

felixdivo avatar Jan 21 '22 09:01 felixdivo

However, pcan does not seem to have that: https://python-can.readthedocs.io/en/develop/interfaces/pcan.html#bus

Also VectorBus says this: https://github.com/hardbyte/python-can/blob/d8e9dc5a64326926f744ecd2a9d0658a2acac5ed/can/interfaces/vector/canlib.py#L98 But BusABC does not mention receive_own_messages. Maybe we should add it to the BusABC arguments.

zariiii9003 avatar Jan 21 '22 11:01 zariiii9003

I think we should close this issue (not a bug, just bad docs) and open a new one for improving documentation (and possibly the naming) of common parameters. Maybe we could also add a table comparing all the interfaces and their capabilities.

felixdivo avatar Feb 06 '22 10:02 felixdivo

Can you show me how to log receive message? I don't know how to log can datas.

zhoulian1992 avatar Jun 02 '22 07:06 zhoulian1992

@zhoulian1992 This has nothing to do with this issue. Have you tried print(message) or str(message)? If that does not work, open a new issue.

felixdivo avatar Jun 02 '22 09:06 felixdivo