dprint.py 280 Bytes
Newer Older
Ivana Krumlova's avatar
Ivana Krumlova committed
1 2
from __future__ import print_function

3 4 5 6 7
import os
import threading

dprint_lock = threading.Lock()

Petr Špaček's avatar
Petr Špaček committed
8

9 10 11 12
def dprint(tag, msg):
    """ Verbose logging (if enabled). """
    if 'VERBOSE' in os.environ:
        dprint_lock.acquire()
Ivana Krumlova's avatar
Ivana Krumlova committed
13
        print(tag, msg)
14
        dprint_lock.release()