summaryrefslogtreecommitdiffstats
path: root/server/src/log.py
blob: 9873adedace3e26a39bbed8fefcb6520e234d589 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""Log information handler."""

import sys
import threading


_lock = threading.Lock()


def info(string):
    """Prints the informations string to the interface.

    Args:
        string: String to be printed.
    """
    with _lock:
        info.interface.write('info: ' + string)
        info.interface.flush()

info.interface = sys.stdout  # Interface of the info string to be printed at.


def error(string):
    """Prints the error string to the interface.

    Args:
        string: String to be printed.
    """
    with _lock:
        error.interface.write('error: ' + string)
        error.interface.flush()

error.interface = sys.stderr  # Interface of the error string to be printed at.