This file is indexed.

/usr/share/pyshared/cream/log.py is in python-cream 0.5.3-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Copyright: 2007-2013, Sebastian Billaudelle <sbillaudelle@googlemail.com>
#            2010-2013, Kristoffer Kleine <kris.kleine@yahoo.de>

# This library is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.

# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

from time import strftime
import os

import sys
from cream.util import console

DEBUG = 5
INFO = 4
WARNING = 3
ERROR = 2
FATAL = 1

VERBOSITY = 3

COLORS = {
    DEBUG: console.COLOR_YELLOW,
    INFO: console.COLOR_GREEN,
    WARNING: console.COLOR_BLUE,
    ERROR: console.COLOR_RED,
    FATAL: console.COLOR_RED_BOLD,
}

SHORTS = {
    DEBUG: 'DBG',
    INFO: 'INF',
    WARNING: 'WRN',
    ERROR: 'ERR',
    FATAL: 'FTL',
}

class Messages(object):

    def __init__(self, id=None):

        self.id = id

        self.verbosity = int(os.getenv('CREAM_VERBOSITY', '0')) or VERBOSITY


    def debug(self, message):
        self.process_message(DEBUG, message)


    def info(self, message):
        self.process_message(INFO, message)


    def warning(self, message):
        self.process_message(WARNING, message)


    def error(self, message):
        self.process_message(ERROR, message)


    def fatal(self, message):
        self.process_message(FATAL, message)


    def process_message(self, type, message):

        if self.verbosity >= type:
            s = '%(color)s [%(short)s @ %(time)s] %(message)s%(uncolor)s' % {
                'color'   : COLORS[type],
                'short'   : SHORTS[type],
                'time'    : strftime("%H:%M:%S"),
                'message' : message,
                'uncolor' : console.COLOR_NORMAL
            }
            print s