Skip to content

Commit cfd01eb

Browse files
committed
Add changelog fragments
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
1 parent 9850c5a commit cfd01eb

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Fixed log level mapping to cover whole libssh range -- by :user:`Jakuje`.
2+
3+
Previously, it was not possible to set most verbose libssh log level
4+
``SSH_LOG_TRACE`` to get most verbose log messages useful for debugging
5+
connection issues. To set pylibssh session verbosity to this level, you
6+
can use the following snippet:
7+
8+
from pylibsshext.logging import ANSIBLE_PYLIBSSH_TRACE
9+
10+
# Initializes the new TRACE log level in python logging system
11+
ssh_session = Session()
12+
13+
eh = logging.StreamHandler()
14+
eh.setLevel(logging.ERROR)
15+
16+
dh = logging.FileHandler('ansible-libssh-errors.log')
17+
dh.setLevel(ANSIBLE_PYLIBSSH_TRACE)
18+
19+
logging.getLogger('ansible-pylibssh').addHandler(eh)
20+
logging.getLogger('ansible-pylibssh').addHandler(dh)
21+
22+
ssh_session.set_log_level(ANSIBLE_PYLIBSSH_TRACE)
23+
ssh_session.connect(...)
24+
25+
This is based on :external+python:std:ref:`logging-cookbook` and
26+
:external+python:std:ref:`logging-howto`.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
```

0 commit comments

Comments
 (0)