Reduce log info noise

This commit is contained in:
Julien Duponchelle
2017-04-27 15:46:39 +02:00
parent 2d1c9444c5
commit 1356fd9c69
20 changed files with 27 additions and 42 deletions

View File

@@ -180,19 +180,16 @@ class BaseNode(QtCore.QObject):
# set ports as started
port.setStatus(Port.started)
self.started_signal.emit()
log.info("{} has started".format(self.name()))
elif status == self.stopped:
for port in self._ports:
# set ports as stopped
port.setStatus(Port.stopped)
self.stopped_signal.emit()
log.info("{} has stopped".format(self.name()))
elif status == self.suspended:
for port in self._ports:
# set ports as suspended
port.setStatus(Port.suspended)
self.suspended_signal.emit()
log.info("{} has suspended".format(self.name()))
def initialized(self):
"""
@@ -364,7 +361,7 @@ class BaseNode(QtCore.QObject):
config_path = os.path.join(export_directory, filename)
try:
with open(config_path, "wb") as f:
log.info("saving {} config to {}".format(self.name(), config_path))
log.debug("saving {} config to {}".format(self.name(), config_path))
f.write(raw_body)
except OSError as e:
self.error_signal.emit(self.id(), "could not export config to {}: {}".format(config_path, e))

View File

@@ -41,7 +41,7 @@ if __version_info__[3] != 0:
import faulthandler
# Display a traceback in case of segfault crash. Usefull when frozen
# Not enabled by default for security reason
log.info("Enable catching segfault")
log.debug("Enable catching segfault")
faulthandler.enable()
@@ -104,7 +104,7 @@ class CrashReport:
except Exception as e:
log.error("Can't send crash report to Sentry: {}".format(e))
return
log.info("Crash report sent with event ID: {}".format(client.get_ident(report)))
log.debug("Crash report sent with event ID: {}".format(client.get_ident(report)))
def _add_qt_information(self, context):
try:

View File

@@ -62,7 +62,7 @@ class ExportDebugDialog(QtWidgets.QDialog, Ui_ExportDebugDialog):
self._exportDebugCallback({}, error=True)
def _exportDebugCallback(self, result, error=False, **kwargs):
log.info("Export debug information to %s", self._path)
log.debug("Export debug information to %s", self._path)
try:
with ZipFile(self._path, 'w') as zip:

View File

@@ -1213,7 +1213,7 @@ class GraphicsView(QtWidgets.QGraphicsView):
QtWidgets.QMessageBox.critical(self, "Idle-PC", "Error: {}".format(result["message"]))
else:
router = context["router"]
log.info("{} has received Idle-PC proposals".format(router.name()))
log.debug("{} has received Idle-PC proposals".format(router.name()))
idlepcs = result
if idlepcs and idlepcs[0] != "0x0":
dialog = IdlePCDialog(router, idlepcs, parent=self)
@@ -1247,7 +1247,7 @@ class GraphicsView(QtWidgets.QGraphicsView):
else:
router = context["router"]
idlepc = result["idlepc"]
log.info("{} has received the auto idle-pc value: {}".format(router.name(), idlepc))
log.debug("{} has received the auto idle-pc value: {}".format(router.name(), idlepc))
router.setIdlepc(idlepc)
# apply Idle-PC to all routers with the same IOS image
ios_image = os.path.basename(router.settings()["image"])

View File

@@ -59,10 +59,10 @@ class Link(QtCore.QObject):
super().__init__()
log.info("adding link from {} {} to {} {}".format(source_node.name(),
source_port.name(),
destination_node.name(),
destination_port.name()))
log.debug("adding link from {} {} to {} {}".format(source_node.name(),
source_port.name(),
destination_node.name(),
destination_port.name()))
# create an unique ID
self._id = Link._instance_count
@@ -264,10 +264,10 @@ class Link(QtCore.QObject):
Deletes this link.
"""
log.info("deleting link from {} {} to {} {}".format(self._source_node.name(),
self._source_port.name(),
self._destination_node.name(),
self._destination_port.name()))
log.debug("deleting link from {} {} to {} {}".format(self._source_node.name(),
self._source_port.name(),
self._destination_node.name(),
self._destination_port.name()))
if skip_controller:
self._linkDeletedCallback({})

View File

@@ -324,7 +324,7 @@ class LocalConfig(QtCore.QObject):
try:
if self._last_config_changed and self._last_config_changed < os.stat(self._config_file).st_mtime:
log.info("Client config has changed, reloading it...")
log.debug("Client config has changed, reloading it...")
self._readConfig(self._config_file)
self.config_changed_signal.emit()
except OSError as e:

View File

@@ -464,7 +464,7 @@ class LocalServer(QtCore.QObject):
log.warn("could not delete server log file {}: {}".format(logpath, e))
command += ' --log="{}" --pid="{}"'.format(logpath, self._pid_path())
log.info("Starting local server process with {}".format(command))
log.debug("Starting local server process with {}".format(command))
try:
if sys.platform.startswith("win"):
# use the string on Windows
@@ -477,7 +477,7 @@ class LocalServer(QtCore.QObject):
log.warning('Could not start local server "{}": {}'.format(command, e))
return False
log.info("Local server process has started (PID={})".format(self._local_server_process.pid))
log.debug("Local server process has started (PID={})".format(self._local_server_process.pid))
return True
def _checkLocalServerRunningSlot(self):
@@ -532,7 +532,7 @@ class LocalServer(QtCore.QObject):
if self.localServerProcessIsRunning():
self._stopping = True
log.info("Stopping local server (PID={})".format(self._local_server_process.pid))
log.debug("Stopping local server (PID={})".format(self._local_server_process.pid))
# local server is running, let's stop it
if self._http_client:
self._http_client.shutdown()

View File

@@ -186,7 +186,6 @@ class ATMSwitch(Node):
if "mappings" in properties:
mappings = properties["mappings"]
log.info("ATM switch {} is loading".format(name))
self.create(name, node_id, mappings)
def configPage(self):

View File

@@ -38,7 +38,6 @@ class DockerVM(Node):
def __init__(self, module, server, project):
super().__init__(module, server, project)
log.info("Docker VM is being created")
docker_vm_settings = {"image": "",
"adapters": DOCKER_CONTAINER_SETTINGS["adapters"],

View File

@@ -260,7 +260,7 @@ class Dynamips(Module):
if os.path.basename(ios_router["image"]) == image_path:
if ios_router["idlepc"] != idlepc:
ios_router["idlepc"] = idlepc
log.info("Idle-PC value {} saved into '{}' template".format(idlepc, ios_router["name"]))
log.debug("Idle-PC value {} saved into '{}' template".format(idlepc, ios_router["name"]))
self._saveIOSRouters()
def reset(self):

View File

@@ -48,7 +48,6 @@ class Router(Node):
def __init__(self, module, server, project, platform="c7200"):
super().__init__(module, server, project)
log.info("Router {} is being created".format(platform))
self._dynamips_id = None
router_settings = {"platform": platform,
@@ -155,7 +154,7 @@ class Router(Node):
for name, value in result.items():
if name in self._settings:
if self._settings[name] != value:
log.info("{}: updating {} from '{}' to '{}'".format(self.name(), name, self._settings[name], value))
log.debug("{}: updating {} from '{}' to '{}'".format(self.name(), name, self._settings[name], value))
self._settings[name] = value
elif name not in ("project_id", "port_name_format", "port_segment_size", "first_port_name", "node_directory", "status", "node_id", "width", "height", "compute_id", "node_type", "dynamips_id", "command_line"):
# All key should be known, but we raise error only in debug

View File

@@ -44,8 +44,6 @@ class IOUDevice(Node):
def __init__(self, module, server, project):
super().__init__(module, server, project)
log.info("IOU instance is being created")
iou_device_settings = {"path": "",
"md5sum": "",
"startup_config": "",

View File

@@ -41,7 +41,6 @@ class QemuVM(Node):
def __init__(self, module, server, project):
super().__init__(module, server, project)
log.info("QEMU VM instance is being created")
self._linked_clone = True
qemu_vm_settings = {"usage": "",

View File

@@ -45,7 +45,6 @@ class VirtualBoxVM(Node):
def __init__(self, module, server, project):
super().__init__(module, server, project)
log.info("VirtualBox VM instance is being created")
self._linked_clone = False
virtualbox_vm_settings = {"vmname": "",

View File

@@ -47,7 +47,6 @@ class VMwareVM(Node):
def __init__(self, module, server, project):
super().__init__(module, server, project)
log.info("VMware VM instance is being created")
self._linked_clone = False
vmware_vm_settings = {"vmx_path": "",

View File

@@ -19,9 +19,7 @@
VPCS node implementation.
"""
import os
from gns3.node import Node
from gns3.utils.normalize_filename import normalize_filename
import logging
log = logging.getLogger(__name__)
@@ -41,8 +39,6 @@ class VPCSNode(Node):
def __init__(self, module, server, project):
super().__init__(module, server, project)
log.info("VPCS instance is being created")
vpcs_settings = {"console_host": None,
"startup_script": None,
"console": None}

View File

@@ -90,7 +90,7 @@ class PacketCapture:
if link.capturing():
if self._autostart[link]:
self.startPacketCaptureReader(link)
log.info("Has successfully started capturing packets on {} to {}".format(link.id(), link.capture_file_path()))
log.debug("Has successfully started capturing packets on {} to {}".format(link.id(), link.capture_file_path()))
else:
self.stopPacketCaptureReader(link)
@@ -103,7 +103,7 @@ class PacketCapture:
"""
link.stopCapture()
log.info("Has successfully stopped capturing packets on {}".format(link.id()))
log.debug("Has successfully stopped capturing packets on {}".format(link.id()))
def startPacketCaptureReader(self, link):
"""

View File

@@ -427,7 +427,7 @@ class Project(QtCore.QObject):
log.error("Error while closing project {}: {}".format(self._id, result["message"]))
else:
self.stopListenNotifications()
log.info("Project {} closed".format(self._id))
log.debug("Project {} closed".format(self._id))
self._closed = True
self.project_closed_signal.emit()

View File

@@ -72,7 +72,7 @@ class ConsoleThread(QtCore.QThread):
command = command.replace("%p", str(port))
command = command.replace("%d", self._name)
command = command.replace("%i", self._node.project().id())
command = command.replace("%n", self._node.id())
command = command.replace("%n", str(self._node.id()))
command = command.replace("%c", Controller.instance().httpClient().fullUrl())
# If the console use an apple script we lock to avoid multiple console
@@ -86,7 +86,7 @@ class ConsoleThread(QtCore.QThread):
pass
# log.warning('could not start Telnet console "{}": {}'.format(self._command, e))
finally:
log.info('Telnet console {}:{} closed'.format(host, port))
log.debug('Telnet console {}:{} closed'.format(host, port))
if sys.platform.startswith("darwin") and "osascript" in command:
console_mutex.unlock()
@@ -108,7 +108,7 @@ def nodeTelnetConsole(node, port, command=None):
if not command:
return
log.info('Starting telnet console in thread "{}"'.format(command))
log.debug('Starting telnet console in thread "{}"'.format(command))
console_thread = ConsoleThread(MainWindow.instance(), command, node, port)
console_thread.consoleError.connect(_consoleErrorSlot)
console_thread.start()

View File

@@ -46,7 +46,7 @@ def vncConsole(host, port, command):
command = command.replace("%P", str(port - 5900))
try:
log.info('starting VNC program "{}"'.format(command))
log.debug('starting VNC program "{}"'.format(command))
if sys.platform.startswith("win"):
# use the string on Windows
subprocess.Popen(command)