Browse Source

logging: don't log to file by default

Leaking addresses/pubkeys/txids is a privacy leak...
but with lightning, logging should be enabled by default, as otherwise
issues would be sometimes impossible to debug...
Well, disable it for now.
regtest_lnd
SomberNight 6 years ago
parent
commit
f6a7e6ec7d
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 1
      electrum/commands.py
  2. 4
      electrum/gui/qt/main_window.py
  3. 2
      electrum/logging.py

1
electrum/commands.py

@ -942,7 +942,6 @@ def add_global_options(parser):
group.add_argument("--testnet", action="store_true", dest="testnet", default=False, help="Use Testnet")
group.add_argument("--regtest", action="store_true", dest="regtest", default=False, help="Use Regtest")
group.add_argument("--simnet", action="store_true", dest="simnet", default=False, help="Use Simnet")
group.add_argument("--disablefilelogging", action="store_true", dest="disablefilelogging", default=None, help="Do not log to file")
def get_parser():
# create main parser

4
electrum/gui/qt/main_window.py

@ -3011,9 +3011,9 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
gui_widgets.append((updatecheck_cb, None))
filelogging_cb = QCheckBox(_("Write logs to file"))
filelogging_cb.setChecked(not self.config.get('disablefilelogging', False))
filelogging_cb.setChecked(bool(self.config.get('log_to_file', False)))
def on_set_filelogging(v):
self.config.set_key('disablefilelogging', v == Qt.Unchecked, save=True)
self.config.set_key('log_to_file', v == Qt.Checked, save=True)
filelogging_cb.stateChanged.connect(on_set_filelogging)
filelogging_cb.setToolTip(_('Debug logs can be persisted to disk. These are useful for troubleshooting.'))
gui_widgets.append((filelogging_cb, None))

2
electrum/logging.py

@ -233,7 +233,7 @@ def configure_logging(config):
_configure_verbosity(verbosity=verbosity, verbosity_shortcuts=verbosity_shortcuts)
is_android = 'ANDROID_DATA' in os.environ
if is_android or config.get('disablefilelogging'):
if is_android or not config.get('log_to_file', False):
pass # disable file logging
else:
log_directory = pathlib.Path(config.path) / "logs"

Loading…
Cancel
Save