casatelemetry/private/casatelemetry.py

Modified
9 9 import casatools
10 10 import casatasks
11 11 from casatelemetry import CrashReporter
12 12 import casatelemetry.private.TelemetryLogMonitor as TelemetryLogMonitor
13 13 import ssl
14 14 import logging
15 15 import sys
16 16
17 17 class telemetry:
18 18
19 - def __init__(self):
19 + def __init__(self, logdir_in=None):
20 20
21 21 from pathlib import Path
22 22 home = str(Path.home())
23 23 self.casalogger = casatools.logsink()
24 24 self.setCasaVersion()
25 25 self.setHostId()
26 26 self.telemetry_enabled = True
27 27 casa_util = casatools.utils.utils()
28 - self.logdir = home +"/.casa"
29 - # Check if user has defined a telemetry log location
30 - if (casatasks.config.telemetry_log_directory != None):
31 - self.logdir = casatasks.config.telemetry_log_directory
28 + if logdir_in == None:
29 + self.logdir = home +"/.casa"
30 + # Check if user has defined a telemetry log location
31 + if (casatasks.config.telemetry_log_directory != None):
32 + self.logdir = casatasks.config.telemetry_log_directory
33 + else:
34 + self.logdir = os.path.abspath(os.path.expanduser(logdir_in))
32 35 self.variantSuffix = ""
33 36 #if len(casa['variant'])>1:
34 37 # self.variantSuffix = "-" + casa['variant']
35 38 self.logpattern = 'casastats-' + self.casaver + '-' + self.hostid + '*' + self.variantSuffix + '.log'
36 39 self.sendlogpattern = 'casastats-*'+ self.hostid + '*.log'
37 40 self.stampfile = self.logdir + '/telemetry-' + self.hostid + '.stamp'
38 41 #self.logfile = 'casastats-' + self.casaver + '-' + self.hostid + self.variantSuffix + '.log'
39 42 #self.casa = casa
40 43
41 44 logfiles = []

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut