1
# PiTiVi , Non-linear video editor
3
# pitivi/log/loggable.py
5
# Copyright (c) 2009, Alessandro Decina <alessandro.decina@collabora.co.uk>
7
# This program is free software; you can redistribute it and/or
8
# modify it under the terms of the GNU Lesser General Public
9
# License as published by the Free Software Foundation; either
10
# version 2.1 of the License, or (at your option) any later version.
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
# Lesser General Public License for more details.
17
# You should have received a copy of the GNU Lesser General Public
18
# License along with this program; if not, write to the
19
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20
# Boston, MA 02110-1301, USA.
22
from pitivi.log.log import _canShortcutLogging, doLog, ERROR
23
from pitivi.log import log
26
class Loggable(log.Loggable):
28
if not hasattr(self, 'logCategory'):
29
self.logCategory = self.__class__.__name__.lower()
31
def logObjectName(self):
32
res = log.Loggable.logObjectName(self)
34
return "<%s at 0x%x>" % (self.__class__.__name__, id(self))
37
def error(self, format, *args):
38
if _canShortcutLogging(self.logCategory, ERROR):
40
doLog(ERROR, self.logObjectName(), self.logCategory,
41
format, self.logFunction(*args), where=-2)