Pārlūkot izejas kodu

Apation to new loggging

mod_update
Dirk Alders 4 gadus atpakaļ
vecāks
revīzija
e4cdd3b7c1
11 mainītis faili ar 25 papildinājumiem un 23 dzēšanām
  1. 10
    12
      config_example/config.py
  2. 1
    1
      garage_protocol
  3. 1
    1
      helpers
  4. 1
    1
      report
  5. 1
    1
      rpi_envsens
  6. 6
    2
      smarthome.py
  7. 1
    1
      socket_protocol
  8. 1
    1
      stringtools
  9. 1
    1
      task
  10. 1
    1
      tcp_socket
  11. 1
    1
      wetation_protocol

+ 10
- 12
config_example/config.py Parādīt failu

@@ -1,10 +1,7 @@
1 1
 #!/usr/bin/env python
2 2
 # -*- coding: UTF-8 -*-
3 3
 
4
-import socket_protocol
5
-import stringtools
6
-import task
7
-import tcp_socket
4
+import report
8 5
 
9 6
 FULL_SCREEN = False
10 7
 
@@ -31,11 +28,12 @@ File "%(pathname)s", line %(lineno)d, in %(funcName)s
31 28
 %(asctime)s: %(levelname)-7s - %(message)s"""
32 29
 """ A long formatter which results in links to the source code inside Eclipse"""
33 30
 
34
-loggers = (
35
-    ('APP', 'DEBUG'),
36
-    (socket_protocol.logger_name, 'WARNING'),
37
-    (stringtools.logger_name, 'WARNING'),
38
-    (task.logger_name, 'WARNING'),
39
-    (tcp_socket.logger_name, 'WARNING'),
40
-)
41
-formatter = LONG_FMT
31
+# Logging
32
+#
33
+APP_NAME = 'smarthome'
34
+LOGTARGET = 'stdout'   # possible choices are: 'logfile' or 'stdout'
35
+
36
+LOGHOST = 'localhost'
37
+LOGPORT = 19996
38
+
39
+formatter = report.LONG_FMT

+ 1
- 1
garage_protocol

@@ -1 +1 @@
1
-Subproject commit ae391a4698abc0834519cfade3c96b06a59a22d9
1
+Subproject commit c5f4e0323aa0a07d996372f94c9652be6fad3919

+ 1
- 1
helpers

@@ -1 +1 @@
1
-Subproject commit 43e0d556d1bbe6fed06bf5a90fa1bea8a8b2c81e
1
+Subproject commit 53e9e080f8f19c068135a67ede6ac736ba3bf94c

+ 1
- 1
report

@@ -1 +1 @@
1
-Subproject commit ce174339bc61a57dbb1c152f329d01ec4a5e1040
1
+Subproject commit 25889f225b3593d515e37bebffef21458c961f64

+ 1
- 1
rpi_envsens

@@ -1 +1 @@
1
-Subproject commit a0bfadcce811fcf2190d830dddb717dabc07875e
1
+Subproject commit f8cb99aa08dd26583588de206c2774a1a0b8e2bf

+ 6
- 2
smarthome.py Parādīt failu

@@ -18,7 +18,11 @@ import time
18 18
 import wetation_protocol
19 19
 import wx
20 20
 
21
-logger = logging.getLogger('APP')
21
+try:
22
+    from config import APP_NAME as ROOT_LOGGER_NAME
23
+except ImportError:
24
+    ROOT_LOGGER_NAME = 'root'
25
+logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
22 26
 
23 27
 
24 28
 class WetationFrameProt(gui.Wetation):
@@ -340,7 +344,7 @@ class MyApp(wx.App):
340 344
 
341 345
 
342 346
 if __name__ == "__main__":
343
-    report.appLoggingConfigure(os.path.dirname(__file__), config.LOGTARGET, config.loggers, fmt=config.formatter)
347
+    report.appLoggingConfigure(os.path.dirname(__file__), config.LOGTARGET, ((config.APP_NAME, 'DEBUG'), ), fmt=config.formatter, host=config.LOGHOST, port=config.LOGPORT)
344 348
     #
345 349
     app = MyApp(0)
346 350
     app.frame.run()

+ 1
- 1
socket_protocol

@@ -1 +1 @@
1
-Subproject commit cd508340e390fc01ebdf81eae3b1e221aa1b658a
1
+Subproject commit 8a8522d26b486b005f65e7e542742e898f1109e7

+ 1
- 1
stringtools

@@ -1 +1 @@
1
-Subproject commit d5f9931bcab942ac84d8f09b1559995da0d2676c
1
+Subproject commit 76d8ae9b1bfd894bc5f4b830394ce0552120a508

+ 1
- 1
task

@@ -1 +1 @@
1
-Subproject commit d3fbc5934051ab165723ca37e8f02596329f174a
1
+Subproject commit bbc3c6f93588942087d617e33bc5797041ae2658

+ 1
- 1
tcp_socket

@@ -1 +1 @@
1
-Subproject commit d9bdc909e98f627fea4417d027ae5d9cb9e2ed81
1
+Subproject commit 576494b2008b857ed9b6c4bb3f162b5c73cf4b33

+ 1
- 1
wetation_protocol

@@ -1 +1 @@
1
-Subproject commit e9c6321772df731317b5398b624e10ff509d489b
1
+Subproject commit cdc9912f3d26edea9e0a36b0fccfc7d3bfd6b868

Notiek ielāde…
Atcelt
Saglabāt