MCPcopy Create free account
hub / github.com/Keeper-Security/Commander / SshAgentLogCommand

Class SshAgentLogCommand

keepercommander/commands/ssh_agent.py:897–919  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

895
896
897class SshAgentLogCommand(Command):
898 def get_parser(self):
899 return ssh_agent_log_parser
900
901 def execute(self, params, **kwargs):
902 if not isinstance(params.ssh_agent, SshAgentContext):
903 logging.warning('SSH Agent is not started')
904 return
905 table = []
906 headers = ['Time', 'Level', 'Message']
907 for record in params.ssh_agent.log_messages:
908 if record.levelno <= logging.DEBUG:
909 severity = 'DEBUG'
910 elif record.levelno <= logging.INFO:
911 severity = 'INFO'
912 elif record.levelno <= logging.WARNING:
913 severity = 'WARN'
914 else:
915 severity = 'ERROR'
916 message = record.msg % record.args
917 table.append([datetime.datetime.fromtimestamp(int(record.created)), severity, message])
918
919 return dump_report_data(table, headers=headers, fmt=kwargs.get('format'), filename=kwargs.get('output'))

Callers 2

__init__Method · 0.85
executeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected