How to log the output from the multiple telnet sessions to separate log file

dieter dieter at handshake.de
Sat Oct 17 02:10:52 EDT 2015


manjunatha.mahalingappa at gmail.com writes:
> I'm very much new to python. 
> I'm doing the automation for networking device testing , I will be opening the 4 telnet session, and doing some testing operations on each of those  telnet sessions and capture or log the respective output in 4 different log files.

Personally, I find it a bit strange that each (telnet) session
should get its own logfile, but, if that is what you need, I would
approach it as follows:

  * define a class "TelnetSession"; create a logger in its "__init__" method;
    use this logger for all operations inside a "TelnetSession"

  * instantiate the class "TelnetSession" for each telnet session you
    want to open.
    Use those objects method to operate on the sessions.




More information about the Python-list mailing list