File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ Fixed log level mapping to cover whole libssh range -- by :user: `Jakuje `.
2+
3+ Previously, it was not possible to set the most verbose libssh ``log `` level
4+ ``SSH_LOG_TRACE `` to get most verbose log messages useful for debugging
5+ connection issues. To set |project | session verbosity to this level, you
6+ can use the following snippet:
7+
8+ .. code-block :: python
9+
10+ from pylibsshext.session import Session
11+ from pylibsshext.logging import ANSIBLE_PYLIBSSH_TRACE
12+
13+ # Initializes the new TRACE log level in python logging system
14+ ssh_session = Session()
15+
16+ eh = logging.StreamHandler()
17+ eh.setLevel(logging.ERROR )
18+
19+ dh = logging.FileHandler(' ansible-libssh-errors.log' )
20+ dh.setLevel(ANSIBLE_PYLIBSSH_TRACE )
21+
22+ logging.getLogger(' ansible-pylibssh' ).addHandler(eh)
23+ logging.getLogger(' ansible-pylibssh' ).addHandler(dh)
24+
25+ ssh_session.set_log_level(ANSIBLE_PYLIBSSH_TRACE )
26+ ssh_session.connect(... )
27+
28+ For typical :mod: `logging ` usage patterns, check out
29+ :external+python:std:ref: `logging-cookbook ` and
30+ :external+python:std:ref: `logging-howto `.
Original file line number Diff line number Diff line change 1+ Made libssh use the Python :py:mod: `logging ` system -- by :user: `Jakuje `.
2+
3+ Previously, the logging was done by underlying C-code to stderr instead,
4+ which caused inconsistent behavior.
5+
6+ The default log level is now set to ``ANSIBLE_PYLIBSSH_TRACE ``
7+ and donstream loggers are able to trim the verbosity down.
8+ If you need a performance, you can avoid logging on the libssh
9+ side at source by setting lower logging value, for example:
10+
11+ ```
12+ ssh_session.set_log_level(ANSIBLE_PYLIBSSH_NOLOG)
13+ ```
You can’t perform that action at this time.
0 commit comments