File: logger.py

package info (click to toggle)
jabref 3.8.1%2Bds-3%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 18,336 kB
  • sloc: java: 114,114; xml: 3,985; python: 283; sh: 282; perl: 200; ruby: 22; makefile: 6
file content (29 lines) | stat: -rw-r--r-- 855 bytes parent folder | download | duplicates (4)
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
def enum(**enums):
    return type('Enum', (), enums)


OUTPUT_COLORS = enum(
    OK='\033[0;32m',
    WARN='\033[0;33m',
    ERROR='\033[0;31m',
    ENDC='\033[0;38m'
)


def error(content):
    print u"{color_error}{content}{color_end}".encode('utf8') \
        .format(color_error=OUTPUT_COLORS.ERROR, content=str(content.encode('utf8')), color_end=OUTPUT_COLORS.ENDC)


def warn(content):
    print u"{color_error}{content}{color_end}".encode('utf8') \
        .format(color_error=OUTPUT_COLORS.WARN, content=str(content.encode('utf8')), color_end=OUTPUT_COLORS.ENDC).encode('utf8')


def ok(content):
    print u"{color_error}{content}{color_end}".encode('utf8') \
        .format(color_error=OUTPUT_COLORS.OK, content=str(content.encode('utf8')), color_end=OUTPUT_COLORS.ENDC).encode('utf8')


def neutral(content):
    print content.encode('utf8')