Merge pull request #1357 from jMyles/logging

Two fixes for logging woes.
pull/1360/head
David Núñez 2019-09-24 11:07:54 +02:00 committed by GitHub
commit c5db2b5301
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -298,6 +298,7 @@ commands:
command: |
mkdir -p ~/test-logs/
mv ~/.cache/nucypher/log/nucypher.log ~/test-logs/nucypher-container-$CIRCLE_NODE_INDEX.log
when: always
- store_artifacts:
path: ~/test-logs/

View File

@ -14,7 +14,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with nucypher. If not, see <https://www.gnu.org/licenses/>.
"""
from contextlib import contextmanager
from functools import lru_cache
import pathlib
@ -79,6 +79,16 @@ class GlobalLoggerSettings:
def stop_console_logging(cls):
globalLogPublisher.removeObserver(console_observer)
@classmethod
@contextmanager
def pause_console_logging_while(cls):
was_already_going = console_observer in globalLogPublisher._observers
if was_already_going:
globalLogPublisher.removeObserver(console_observer)
yield
if was_already_going:
globalLogPublisher.addObserver(console_observer)
@classmethod
def start_text_file_logging(cls):
globalLogPublisher.addObserver(get_text_file_observer())