Standardized logging code to all global var; writers now accessible from all files (#62)

* added skeleton for terminal logger

* done skeleton terminal writer logic... todo: actual calls to the write classes

* moved lambda to top function

* added logic to support timing

* prettier printing

* prettier printing

* lint

* separated out timing and other stats variables. printing in dict format

* keeping logging history and wiping rest

* updated logic to calculate total times instead of average times

* made stats tracker configurable

* moved stats tracker and profiler to own class file; implemented basic functionality for profiler

* lint removing duplicate function

* update readme; moved around config variables

* profiler prints on sig kill

* merge

* standardized all logging to global variables
This commit is contained in:
evonneng authored and GitHub committed 2022-05-06 21:55:33 -07:00
1 parent 5cb00c286d
commit a498a6cc64
9 files changed
+322 -67

No files matched your search

+4 -2
View File
@@ -3,6 +3,8 @@ Decorator definitions
"""
from typing import Callable, List
from mattport.utils import comms
def decorate_all(decorators: List[Callable]) -> Callable:
"""A decorator to decorate all member functions of a class"""
@@ -34,7 +36,7 @@ def check_profiler_enabled(func: Callable) -> Callable:
def wrapper(self, *args, **kwargs):
ret = None
if self.config.logging.enable_stats:
if self.config.enable_stats:
ret = func(self, *args, **kwargs)
return ret
@@ -46,7 +48,7 @@ def check_main_thread(func: Callable) -> Callable:
def wrapper(self, *args, **kwargs):
ret = None
if self.is_main_thread:
if comms.is_main_process():
ret = func(self, *args, **kwargs)
return ret