Browse Source

add logging to life game

Bastien Sevajol 8 years ago
parent
commit
2bbc159bdb
3 changed files with 22 additions and 4 deletions
  1. 1 1
      sandbox/engulf/run.py
  2. 20 2
      sandbox/life_game/run.py
  3. 1 1
      synergine2/core.py

+ 1 - 1
sandbox/engulf/run.py View File

146
 
146
 
147
     config = Config()
147
     config = Config()
148
     logger = get_default_logger(level=logging.DEBUG)
148
     logger = get_default_logger(level=logging.DEBUG)
149
-    logger.debug('HELLO')
149
+
150
     core = Core(
150
     core = Core(
151
         config=config,
151
         config=config,
152
         logger=logger,
152
         logger=logger,

+ 20 - 2
sandbox/life_game/run.py View File

2
 import os
2
 import os
3
 import sys
3
 import sys
4
 
4
 
5
+import logging
6
+
7
+from synergine2.config import Config
8
+from synergine2.log import get_default_logger
9
+
5
 synergine2_ath = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../'))
10
 synergine2_ath = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../'))
6
 sys.path.append(synergine2_ath)
11
 sys.path.append(synergine2_ath)
7
 
12
 
126
     )
131
     )
127
     simulation.subjects = subjects
132
     simulation.subjects = subjects
128
 
133
 
134
+    config = Config()
135
+    logger = get_default_logger(level=logging.DEBUG)
136
+
129
     core = Core(
137
     core = Core(
138
+        config=config,
139
+        logger=logger,
130
         simulation=simulation,
140
         simulation=simulation,
131
-        cycle_manager=CycleManager(simulation=simulation),
132
-        terminal_manager=TerminalManager([CocosTerminal(), SimplePrintTerminal()]),
141
+        cycle_manager=CycleManager(
142
+            config=config,
143
+            logger=logger,
144
+            simulation=simulation,
145
+        ),
146
+        terminal_manager=TerminalManager(
147
+            config=config,
148
+            logger=logger,
149
+            terminals=[CocosTerminal(), SimplePrintTerminal()]
150
+        ),
133
     )
151
     )
134
     core.run()
152
     core.run()
135
 
153
 

+ 1 - 1
synergine2/core.py View File

23
         self.logger = logger
23
         self.logger = logger
24
         self.simulation = simulation
24
         self.simulation = simulation
25
         self.cycle_manager = cycle_manager
25
         self.cycle_manager = cycle_manager
26
-        self.terminal_manager = terminal_manager or TerminalManager([])
26
+        self.terminal_manager = terminal_manager or TerminalManager(config, logger, [])
27
         self._loop_delta = 1./cycles_per_seconds
27
         self._loop_delta = 1./cycles_per_seconds
28
         self._current_cycle_start_time = None
28
         self._current_cycle_start_time = None
29
 
29