This file is indexed.

/usr/share/pyshared/remuco/log.py is in remuco-base 0.9.6-2.

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
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
# =============================================================================
#
#    Remuco - A remote control system for media players.
#    Copyright (C) 2006-2010 by the Remuco team, see AUTHORS.
#
#    This file is part of Remuco.
#
#    Remuco is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    Remuco 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 General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with Remuco.  If not, see <http://www.gnu.org/licenses/>.
#
# =============================================================================

import logging

DEBUG = logging.DEBUG
INFO = logging.INFO
WARNING = logging.WARNING
ERROR = logging.ERROR

#===============================================================================
# set up default logger
#===============================================================================

class _config:
    """Configuration container"""
    
    FMT = logging.Formatter("%(asctime)s [%(levelname)7s] [%(filename)11s " +
                            "%(lineno)4d] %(message)s")
    FMTX = logging.Formatter("%(levelname)s: %(message)s (check the log for "
                             "details)")
    
    handler_stdout = logging.StreamHandler()
    handler_stdout.setFormatter(FMT)
    handler = handler_stdout
    
    logga = logging.getLogger("remuco")
    logga.addHandler(handler)
    logga.setLevel(INFO)

#===============================================================================
# log functions
#===============================================================================

debug = _config.logga.debug
info = _config.logga.info
warning = _config.logga.warning
error = _config.logga.error
exception = _config.logga.exception

#===============================================================================
# configuration functions
#===============================================================================

def set_file(file):
    """Set log file (pass None to log to stdout)."""
 
    new_handler = None
    if file is not None:
        try:
            new_handler = logging.FileHandler(file, 'w')
        except IOError, e:
            print("failed to set up log handler (%s)" % e)
            return
        new_handler.setFormatter(_config.FMT)
        print("Log output will be stored in %s" % file)
        print("Contribute to Remuco: Please run 'remuco-report' once a client "
              "has connected, thanks!")
    
    if _config.handler != _config.handler_stdout:
        _config.logga.removeHandler(_config.handler)
    if new_handler:
        _config.handler_stdout.setLevel(ERROR)
        _config.handler_stdout.setFormatter(_config.FMTX)
        _config.logga.addHandler(new_handler)
        _config.handler = new_handler
    else:
        _config.handler_stdout.setLevel(_config.logga.level)
        _config.handler_stdout.setFormatter(_config.FMT)
        _config.handler = _config.handler_stdout
    
def set_level(level):
    """ Set log level (one of log.DEBUG, log.INFO, log.WARNING, log.ERROR)."""
    
    _config.logga.setLevel(level)
    
    if _config.handler is not None:
        _config.handler.setLevel(level)