Quellcode durchsuchen

stdout logging configuration added

master
Dirk Alders vor 4 Jahren
Ursprung
Commit
b9184d3e41
1 geänderte Dateien mit 17 neuen und 11 gelöschten Zeilen
  1. 17
    11
      __init__.py

+ 17
- 11
__init__.py Datei anzeigen

@@ -151,9 +151,10 @@ class collectingTestcaseHandler(collectingHandler):
151 151
         self.MY_LOGS.append(record.__dict__)
152 152
         self.MY_LOGS[-1]['moduleLogger'] = collectingHandler().get_logs()
153 153
 
154
-
155 154
 def appLoggingConfigure(basepath, target, log_name_lvl=[], fmt=SHORT_FMT, ring_logs=None):
156
-    target_handlers = ['main', 'logwarn']
155
+    target_handlers = ['main', ]
156
+    if basepath is not None:
157
+        target_handlers.append('logwarn')
157 158
     # define handler
158 159
     #
159 160
     if target == 'stdout':
@@ -185,15 +186,16 @@ def appLoggingConfigure(basepath, target, log_name_lvl=[], fmt=SHORT_FMT, ring_l
185 186
             'class': 'report.collectingRingHandler',
186 187
             'max_logs': ring_logs,
187 188
         }
188
-    handler['logwarn'] = {
189
-        'level': 'WARNING',
190
-        'formatter': 'long',
191
-        'class': 'logging.handlers.RotatingFileHandler',
192
-        'filename': os.path.join(basepath, 'messages.warn'),
193
-        'mode': 'a',
194
-        'maxBytes': 10485760,
195
-        'backupCount': 2
196
-    }
189
+    if basepath is not None:
190
+        handler['logwarn'] = {
191
+            'level': 'WARNING',
192
+            'formatter': 'long',
193
+            'class': 'logging.handlers.RotatingFileHandler',
194
+            'filename': os.path.join(basepath, 'messages.warn'),
195
+            'mode': 'a',
196
+            'maxBytes': 10485760,
197
+             'backupCount': 2
198
+        }
197 199
     # define loggers
198 200
     #
199 201
     loggers = {}
@@ -220,6 +222,10 @@ def appLoggingConfigure(basepath, target, log_name_lvl=[], fmt=SHORT_FMT, ring_l
220 222
     ))
221 223
 
222 224
 
225
+def stdoutLoggingConfigure(log_name_lvl=[], fmt=SHORT_FMT):
226
+    appLoggingConfigure(None, 'stdout', log_name_lvl=log_name_lvl, fmt=fmt)
227
+
228
+
223 229
 class testSession(dict):
224 230
     KEY_NAME = 'name'
225 231
     KEY_FAILED_TESTS = 'number_of_failed_tests'

Laden…
Abbrechen
Speichern