~timo-jyrinki/ubuntu/trusty/pitivi/backport_utopic_fixes

« back to all changes in this revision

Viewing changes to pitivi/log/loggable.py

  • Committer: Package Import Robot
  • Author(s): Sebastian Dröge
  • Date: 2014-04-05 15:28:16 UTC
  • mfrom: (6.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20140405152816-6lijoax4cngiz5j5
Tags: 0.93-3
* debian/control:
  + Depend on python-gi (>= 3.10), older versions do not work
    with pitivi (Closes: #732813).
  + Add missing dependency on gir1.2-clutter-gst-2.0 (Closes: #743692).
  + Add suggests on gir1.2-notify-0.7 and gir1.2-gnomedesktop-3.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# PiTiVi , Non-linear video editor
2
 
#
3
 
#       pitivi/log/loggable.py
4
 
#
5
 
# Copyright (c) 2009, Alessandro Decina <alessandro.decina@collabora.co.uk>
6
 
#
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.
11
 
#
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.
16
 
#
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.
21
 
 
22
 
from pitivi.log.log import _canShortcutLogging, doLog, ERROR
23
 
from pitivi.log import log
24
 
 
25
 
 
26
 
class Loggable(log.Loggable):
27
 
    def __init__(self):
28
 
        if not hasattr(self, 'logCategory'):
29
 
            self.logCategory = self.__class__.__name__.lower()
30
 
 
31
 
    def logObjectName(self):
32
 
        res = log.Loggable.logObjectName(self)
33
 
        if not res:
34
 
            return "<%s at 0x%x>" % (self.__class__.__name__, id(self))
35
 
        return res
36
 
 
37
 
    def error(self, format, *args):
38
 
        if _canShortcutLogging(self.logCategory, ERROR):
39
 
            return
40
 
        doLog(ERROR, self.logObjectName(), self.logCategory,
41
 
            format, self.logFunction(*args), where=-2)