mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
updated logging: save to file
This commit is contained in:
parent
58925dce9c
commit
b921c1b33b
4 changed files with 14 additions and 5 deletions
|
@ -213,11 +213,12 @@ class CMDTCPRequestHandler(socketserver.BaseRequestHandler):
|
||||||
|
|
||||||
#exception, if JSON cant be decoded
|
#exception, if JSON cant be decoded
|
||||||
#except Exception as e:
|
#except Exception as e:
|
||||||
except ValueError as e:
|
except:
|
||||||
print("############ START OF ERROR #####################")
|
print("############ START OF ERROR #####################")
|
||||||
print('DAEMON PROGRAM ERROR: %s' %str(e))
|
print('DAEMON PROGRAM ERROR: %s' %str(e))
|
||||||
print("Wrong command")
|
print("Wrong command")
|
||||||
print(data)
|
print(data)
|
||||||
|
e = sys.exc_info()[0]
|
||||||
print(e)
|
print(e)
|
||||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||||
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
||||||
|
|
|
@ -221,7 +221,12 @@ def setup_logging():
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
logging.basicConfig(format='%(asctime)s.%(msecs)03d %(levelname)s:\t%(message)s', datefmt='%H:%M:%S', level=logging.INFO)
|
logging.basicConfig(level=logging.INFO, \
|
||||||
|
encoding='utf-8', \
|
||||||
|
format='%(asctime)s.%(msecs)03d %(levelname)s:\t%(message)s', \
|
||||||
|
datefmt='%H:%M:%S', \
|
||||||
|
handlers=[logging.FileHandler("codec2-FreeDATA-TNC.log"),logging.StreamHandler()]
|
||||||
|
)
|
||||||
|
|
||||||
logging.addLevelName(logging.DEBUG, "\033[1;36m%s\033[1;0m" % logging.getLevelName(logging.DEBUG))
|
logging.addLevelName(logging.DEBUG, "\033[1;36m%s\033[1;0m" % logging.getLevelName(logging.DEBUG))
|
||||||
logging.addLevelName(logging.INFO, "\033[1;37m%s\033[1;0m" % logging.getLevelName(logging.INFO))
|
logging.addLevelName(logging.INFO, "\033[1;37m%s\033[1;0m" % logging.getLevelName(logging.INFO))
|
||||||
|
|
|
@ -159,6 +159,8 @@ class RF():
|
||||||
|
|
||||||
self.my_rig.open()
|
self.my_rig.open()
|
||||||
|
|
||||||
|
# set rig mode to USB
|
||||||
|
self.my_rig.set_mode(Hamlib.RIG_MODE_USB)
|
||||||
except:
|
except:
|
||||||
print("Unexpected error:", sys.exc_info()[0])
|
print("Unexpected error:", sys.exc_info()[0])
|
||||||
print("can't open rig")
|
print("can't open rig")
|
||||||
|
|
|
@ -247,9 +247,10 @@ class CMDTCPRequestHandler(socketserver.BaseRequestHandler):
|
||||||
|
|
||||||
#exception, if JSON cant be decoded
|
#exception, if JSON cant be decoded
|
||||||
#except Exception as e:
|
#except Exception as e:
|
||||||
except ValueError as e:
|
except:
|
||||||
print("############ START OF ERROR #####################")
|
print("############ START OF ERROR #####################")
|
||||||
print("SOCKET COMMAND ERROR: " + data)
|
print("SOCKET COMMAND ERROR: " + data)
|
||||||
|
e = sys.exc_info()[0]
|
||||||
print(e)
|
print(e)
|
||||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||||
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
||||||
|
|
Loading…
Reference in a new issue