From: Antonio Ospite Date: Thu, 24 Dec 2015 09:58:26 +0000 (+0100) Subject: Don't add trailing spaces when producing logs X-Git-Url: https://git.ao2.it/SaveMySugar/python3-savemysugar.git/commitdiff_plain/bbe279dcaf1fd1f0fe68dfe2dce0ce566ce09f73 Don't add trailing spaces when producing logs --- diff --git a/logs/codex_receive.log b/logs/codex_receive.log index b7b05c1..3d8da07 100644 --- a/logs/codex_receive.log +++ b/logs/codex_receive.log @@ -9,63 +9,63 @@ Available hardware serial ports: 1450908982.795762 DEBUG:__init__ call setup time between 7.00 and 9.00 --- wordspace transmit time: 9.00 + 17.20 receive time: between 24.20 and 28.20 1450908982.796474 DEBUG:__init__ call setup time between 7.00 and 9.00 --------- EOM transmit time: 9.00 + 21.20 receive time: between 28.20 and inf 1450908999.873427 INFO:log_symbol distance: 0.00 Received "" (The very first ring) -1450908999.873888 DEBUG:receive_loop Current message: +1450908999.873888 DEBUG:receive_loop Current message: 1450909018.697032 DEBUG:receive_character RINGs distance: 18.82 -1450909018.697943 INFO:log_symbol distance: 18.82 Received "-" +1450909018.697943 INFO:log_symbol distance: 18.82 Received "-" 1450909018.698198 DEBUG:receive_loop Current message: - 1450909033.634731 DEBUG:receive_character RINGs distance: 14.94 -1450909033.635100 INFO:log_symbol distance: 14.94 Received "." +1450909033.635100 INFO:log_symbol distance: 14.94 Received "." 1450909033.635487 DEBUG:receive_loop Current message: -. 1450909053.174349 DEBUG:receive_character RINGs distance: 19.54 -1450909053.174722 INFO:log_symbol distance: 19.54 Received "-" +1450909053.174722 INFO:log_symbol distance: 19.54 Received "-" 1450909053.175028 DEBUG:receive_loop Current message: -.- 1450909067.679047 DEBUG:receive_character RINGs distance: 14.50 -1450909067.679415 INFO:log_symbol distance: 14.50 Received "." +1450909067.679415 INFO:log_symbol distance: 14.50 Received "." 1450909067.679727 DEBUG:receive_loop Current message: -.-. 1450909090.572602 DEBUG:receive_character RINGs distance: 22.89 1450909090.572990 INFO:log_symbol distance: 22.89 Received " " got "c" -1450909090.573298 DEBUG:receive_loop Current message: -.-. +1450909090.573298 DEBUG:receive_loop Current message: -.-. 1450909109.658156 DEBUG:receive_character RINGs distance: 19.09 -1450909109.658531 INFO:log_symbol distance: 19.09 Received "-" +1450909109.658531 INFO:log_symbol distance: 19.09 Received "-" 1450909109.658843 DEBUG:receive_loop Current message: -.-. - 1450909128.258838 DEBUG:receive_character RINGs distance: 18.60 -1450909128.259231 INFO:log_symbol distance: 18.60 Received "-" +1450909128.259231 INFO:log_symbol distance: 18.60 Received "-" 1450909128.259547 DEBUG:receive_loop Current message: -.-. -- 1450909147.453452 DEBUG:receive_character RINGs distance: 19.19 -1450909147.453829 INFO:log_symbol distance: 19.19 Received "-" +1450909147.453829 INFO:log_symbol distance: 19.19 Received "-" 1450909147.454140 DEBUG:receive_loop Current message: -.-. --- 1450909171.056012 DEBUG:receive_character RINGs distance: 23.60 1450909171.056412 INFO:log_symbol distance: 23.60 Received " " got "o" -1450909171.056725 DEBUG:receive_loop Current message: -.-. --- +1450909171.056725 DEBUG:receive_loop Current message: -.-. --- 1450909188.955610 DEBUG:receive_character RINGs distance: 17.90 -1450909188.956066 INFO:log_symbol distance: 17.90 Received "-" +1450909188.956066 INFO:log_symbol distance: 17.90 Received "-" 1450909188.956375 DEBUG:receive_loop Current message: -.-. --- - 1450909204.660274 DEBUG:receive_character RINGs distance: 15.70 -1450909204.660661 INFO:log_symbol distance: 15.70 Received "." +1450909204.660661 INFO:log_symbol distance: 15.70 Received "." 1450909204.660843 DEBUG:receive_loop Current message: -.-. --- -. 1450909219.318021 DEBUG:receive_character RINGs distance: 14.66 -1450909219.318387 INFO:log_symbol distance: 14.66 Received "." +1450909219.318387 INFO:log_symbol distance: 14.66 Received "." 1450909219.318693 DEBUG:receive_loop Current message: -.-. --- -.. 1450909242.249535 DEBUG:receive_character RINGs distance: 22.93 1450909242.249931 INFO:log_symbol distance: 22.93 Received " " got "d" -1450909242.250245 DEBUG:receive_loop Current message: -.-. --- -.. +1450909242.250245 DEBUG:receive_loop Current message: -.-. --- -.. 1450909257.024272 DEBUG:receive_character RINGs distance: 14.77 -1450909257.024643 INFO:log_symbol distance: 14.77 Received "." +1450909257.024643 INFO:log_symbol distance: 14.77 Received "." 1450909257.024987 DEBUG:receive_loop Current message: -.-. --- -.. . 1450909280.280770 DEBUG:receive_character RINGs distance: 23.26 1450909280.281165 INFO:log_symbol distance: 23.26 Received " " got "e" -1450909280.281482 DEBUG:receive_loop Current message: -.-. --- -.. . +1450909280.281482 DEBUG:receive_loop Current message: -.-. --- -.. . 1450909298.635403 DEBUG:receive_character RINGs distance: 18.35 -1450909298.635777 INFO:log_symbol distance: 18.35 Received "-" +1450909298.635777 INFO:log_symbol distance: 18.35 Received "-" 1450909298.636141 DEBUG:receive_loop Current message: -.-. --- -.. . - 1450909313.951031 DEBUG:receive_character RINGs distance: 15.32 -1450909313.951402 INFO:log_symbol distance: 15.32 Received "." +1450909313.951402 INFO:log_symbol distance: 15.32 Received "." 1450909313.951715 DEBUG:receive_loop Current message: -.-. --- -.. . -. 1450909329.159787 DEBUG:receive_character RINGs distance: 15.21 -1450909329.160205 INFO:log_symbol distance: 15.21 Received "." +1450909329.160205 INFO:log_symbol distance: 15.21 Received "." 1450909329.160427 DEBUG:receive_loop Current message: -.-. --- -.. . -.. 1450909347.657410 DEBUG:receive_character RINGs distance: 18.50 -1450909347.657788 INFO:log_symbol distance: 18.50 Received "-" +1450909347.657788 INFO:log_symbol distance: 18.50 Received "-" 1450909347.658102 DEBUG:receive_loop Current message: -.-. --- -.. . -..- 1450909378.307810 DEBUG:receive_character RINGs distance: 30.65 1450909378.308251 INFO:log_symbol distance: 30.65 Received "EOM" got "x" diff --git a/plot/codex_receive.log b/plot/codex_receive.log index 6279881..cf0444b 100644 --- a/plot/codex_receive.log +++ b/plot/codex_receive.log @@ -1,21 +1,21 @@ 1450908999.873427 INFO:log_symbol distance: 0.00 Received "" (The very first ring) -1450909018.697943 INFO:log_symbol distance: 18.82 Received "-" -1450909033.635100 INFO:log_symbol distance: 14.94 Received "." -1450909053.174722 INFO:log_symbol distance: 19.54 Received "-" -1450909067.679415 INFO:log_symbol distance: 14.50 Received "." +1450909018.697943 INFO:log_symbol distance: 18.82 Received "-" +1450909033.635100 INFO:log_symbol distance: 14.94 Received "." +1450909053.174722 INFO:log_symbol distance: 19.54 Received "-" +1450909067.679415 INFO:log_symbol distance: 14.50 Received "." 1450909090.572990 INFO:log_symbol distance: 22.89 Received " " got "c" -1450909109.658531 INFO:log_symbol distance: 19.09 Received "-" -1450909128.259231 INFO:log_symbol distance: 18.60 Received "-" -1450909147.453829 INFO:log_symbol distance: 19.19 Received "-" +1450909109.658531 INFO:log_symbol distance: 19.09 Received "-" +1450909128.259231 INFO:log_symbol distance: 18.60 Received "-" +1450909147.453829 INFO:log_symbol distance: 19.19 Received "-" 1450909171.056412 INFO:log_symbol distance: 23.60 Received " " got "o" -1450909188.956066 INFO:log_symbol distance: 17.90 Received "-" -1450909204.660661 INFO:log_symbol distance: 15.70 Received "." -1450909219.318387 INFO:log_symbol distance: 14.66 Received "." +1450909188.956066 INFO:log_symbol distance: 17.90 Received "-" +1450909204.660661 INFO:log_symbol distance: 15.70 Received "." +1450909219.318387 INFO:log_symbol distance: 14.66 Received "." 1450909242.249931 INFO:log_symbol distance: 22.93 Received " " got "d" -1450909257.024643 INFO:log_symbol distance: 14.77 Received "." +1450909257.024643 INFO:log_symbol distance: 14.77 Received "." 1450909280.281165 INFO:log_symbol distance: 23.26 Received " " got "e" -1450909298.635777 INFO:log_symbol distance: 18.35 Received "-" -1450909313.951402 INFO:log_symbol distance: 15.32 Received "." -1450909329.160205 INFO:log_symbol distance: 15.21 Received "." -1450909347.657788 INFO:log_symbol distance: 18.50 Received "-" +1450909298.635777 INFO:log_symbol distance: 18.35 Received "-" +1450909313.951402 INFO:log_symbol distance: 15.32 Received "." +1450909329.160205 INFO:log_symbol distance: 15.21 Received "." +1450909347.657788 INFO:log_symbol distance: 18.50 Received "-" 1450909378.308251 INFO:log_symbol distance: 30.65 Received "EOM" got "x" diff --git a/plot/savemysugar_receive.log b/plot/savemysugar_receive.log index 8ad9a3d..3ec4d82 100644 --- a/plot/savemysugar_receive.log +++ b/plot/savemysugar_receive.log @@ -1,42 +1,42 @@ 1450904153.118305 INFO:log_symbol distance: 0.00 Received "" (The very first ring) -1450904168.355706 INFO:log_symbol distance: 15.24 Received "." -1450904184.918924 INFO:log_symbol distance: 16.56 Received "." -1450904201.184843 INFO:log_symbol distance: 16.27 Received "." +1450904168.355706 INFO:log_symbol distance: 15.24 Received "." +1450904184.918924 INFO:log_symbol distance: 16.56 Received "." +1450904201.184843 INFO:log_symbol distance: 16.27 Received "." 1450904228.685023 INFO:log_symbol distance: 27.50 Received " " got "s" -1450904245.278527 INFO:log_symbol distance: 16.59 Received "." -1450904266.337133 INFO:log_symbol distance: 21.06 Received "-" +1450904245.278527 INFO:log_symbol distance: 16.59 Received "." +1450904266.337133 INFO:log_symbol distance: 21.06 Received "-" 1450904294.400586 INFO:log_symbol distance: 28.06 Received " " got "a" -1450904310.121147 INFO:log_symbol distance: 15.72 Received "." -1450904326.604792 INFO:log_symbol distance: 16.48 Received "." -1450904342.600480 INFO:log_symbol distance: 16.00 Received "." -1450904363.717868 INFO:log_symbol distance: 21.12 Received "-" +1450904310.121147 INFO:log_symbol distance: 15.72 Received "." +1450904326.604792 INFO:log_symbol distance: 16.48 Received "." +1450904342.600480 INFO:log_symbol distance: 16.00 Received "." +1450904363.717868 INFO:log_symbol distance: 21.12 Received "-" 1450904392.037346 INFO:log_symbol distance: 28.32 Received " " got "v" -1450904407.870990 INFO:log_symbol distance: 15.83 Received "." +1450904407.870990 INFO:log_symbol distance: 15.83 Received "." 1450904442.520219 INFO:log_symbol distance: 34.65 Received "/" got "e" -1450904464.360755 INFO:log_symbol distance: 21.84 Received "-" -1450904485.476352 INFO:log_symbol distance: 21.12 Received "-" +1450904464.360755 INFO:log_symbol distance: 21.84 Received "-" +1450904485.476352 INFO:log_symbol distance: 21.12 Received "-" 1450904513.776730 INFO:log_symbol distance: 28.30 Received " " got "m" -1450904535.918209 INFO:log_symbol distance: 22.14 Received "-" -1450904551.577851 INFO:log_symbol distance: 15.66 Received "." -1450904574.011370 INFO:log_symbol distance: 22.43 Received "-" -1450904595.261952 INFO:log_symbol distance: 21.25 Received "-" +1450904535.918209 INFO:log_symbol distance: 22.14 Received "-" +1450904551.577851 INFO:log_symbol distance: 15.66 Received "." +1450904574.011370 INFO:log_symbol distance: 22.43 Received "-" +1450904595.261952 INFO:log_symbol distance: 21.25 Received "-" 1450904629.718232 INFO:log_symbol distance: 34.46 Received "/" got "y" -1450904645.118816 INFO:log_symbol distance: 15.40 Received "." -1450904661.138536 INFO:log_symbol distance: 16.02 Received "." -1450904677.096260 INFO:log_symbol distance: 15.96 Received "." +1450904645.118816 INFO:log_symbol distance: 15.40 Received "." +1450904661.138536 INFO:log_symbol distance: 16.02 Received "." +1450904677.096260 INFO:log_symbol distance: 15.96 Received "." 1450904705.355626 INFO:log_symbol distance: 28.26 Received " " got "s" -1450904721.024321 INFO:log_symbol distance: 15.67 Received "." -1450904737.920004 INFO:log_symbol distance: 16.90 Received "." -1450904759.706462 INFO:log_symbol distance: 21.79 Received "-" +1450904721.024321 INFO:log_symbol distance: 15.67 Received "." +1450904737.920004 INFO:log_symbol distance: 16.90 Received "." +1450904759.706462 INFO:log_symbol distance: 21.79 Received "-" 1450904787.056216 INFO:log_symbol distance: 27.35 Received " " got "u" -1450904808.973449 INFO:log_symbol distance: 21.92 Received "-" -1450904831.678973 INFO:log_symbol distance: 22.71 Received "-" -1450904847.006727 INFO:log_symbol distance: 15.33 Received "." +1450904808.973449 INFO:log_symbol distance: 21.92 Received "-" +1450904831.678973 INFO:log_symbol distance: 22.71 Received "-" +1450904847.006727 INFO:log_symbol distance: 15.33 Received "." 1450904874.620160 INFO:log_symbol distance: 27.61 Received " " got "g" -1450904890.874667 INFO:log_symbol distance: 16.25 Received "." -1450904912.878299 INFO:log_symbol distance: 22.00 Received "-" +1450904890.874667 INFO:log_symbol distance: 16.25 Received "." +1450904912.878299 INFO:log_symbol distance: 22.00 Received "-" 1450904940.314753 INFO:log_symbol distance: 27.44 Received " " got "a" -1450904956.407403 INFO:log_symbol distance: 16.09 Received "." -1450904978.842952 INFO:log_symbol distance: 22.44 Received "-" -1450904994.195601 INFO:log_symbol distance: 15.35 Received "." +1450904956.407403 INFO:log_symbol distance: 16.09 Received "." +1450904978.842952 INFO:log_symbol distance: 22.44 Received "-" +1450904994.195601 INFO:log_symbol distance: 15.35 Received "." 1450905033.981779 INFO:log_symbol distance: 39.79 Received "EOM" got "r" diff --git a/src/savemysugar/CallDistanceTransceiver.py b/src/savemysugar/CallDistanceTransceiver.py index f218bcc..29c3fb8 100755 --- a/src/savemysugar/CallDistanceTransceiver.py +++ b/src/savemysugar/CallDistanceTransceiver.py @@ -205,7 +205,7 @@ class CallDistanceTransceiver(object): self.end_of_message = False def log_symbol(self, distance, symbol, extra_info=""): - logging.info("distance: %.2f Received \"%s\" %s", distance, symbol, + logging.info("distance: %.2f Received \"%s\"%s", distance, symbol, extra_info) def receive_character(self): @@ -247,7 +247,7 @@ class CallDistanceTransceiver(object): call_distance <= self.signalspace_time.max: signal = self.morse_message.strip().split(' ')[-1] character = self.translator.signal_to_character(signal) - self.log_symbol(call_distance, ' ', "got \"%s\"" % character) + self.log_symbol(call_distance, ' ', " got \"%s\"" % character) self.morse_message += " " return @@ -255,14 +255,14 @@ class CallDistanceTransceiver(object): call_distance <= self.wordspace_time.max: signal = self.morse_message.strip().split(' ')[-1] character = self.translator.signal_to_character(signal) - self.log_symbol(call_distance, '/', "got \"%s\"" % character) + self.log_symbol(call_distance, '/', " got \"%s\"" % character) self.morse_message += " / " return if call_distance > self.eom_time.min: signal = self.morse_message.strip().split(' ')[-1] character = self.translator.signal_to_character(signal) - self.log_symbol(call_distance, 'EOM', "got \"%s\"" % character) + self.log_symbol(call_distance, 'EOM', " got \"%s\"" % character) self.end_of_message = True self.previous_ring_time = -1 self.previous_call_time = -1