Merge lp:~thisfred/ubuntuone-client/fix-status-logging into lp:ubuntuone-client

Proposed by Eric Casteleijn
Status: Merged
Approved by: Alejandro J. Cura
Approved revision: 1044
Merged at revision: 1043
Proposed branch: lp:~thisfred/ubuntuone-client/fix-status-logging
Merge into: lp:ubuntuone-client
Diff against target: 130 lines (+40/-27)
4 files modified
ubuntuone/logger.py (+1/-1)
ubuntuone/platform/linux/messaging.py (+1/-14)
ubuntuone/status/aggregator.py (+2/-12)
ubuntuone/status/logger.py (+36/-0)
To merge this branch: bzr merge lp:~thisfred/ubuntuone-client/fix-status-logging
Reviewer Review Type Date Requested Status
Alejandro J. Cura (community) Approve
Facundo Batista (community) Approve
Review via email: mp+67057@code.launchpad.net

Commit message

Fixed logging for ubuntuone.status.

Description of the change

Fixed logging for ubuntuone.status.

To post a comment you must log in.
1044. By Eric Casteleijn

removed unused import

Revision history for this message
Facundo Batista (facundo) wrote :

Like it!

review: Approve
Revision history for this message
Alejandro J. Cura (alecu) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/logger.py'
2--- ubuntuone/logger.py 2010-04-05 14:51:51 +0000
3+++ ubuntuone/logger.py 2011-07-06 17:02:37 +0000
4@@ -42,7 +42,7 @@
5
6
7 class Logger(logging.Logger):
8- """Logger that support out custom levels."""
9+ """Logger that support our custom levels."""
10
11 def note(self, msg, *args, **kwargs):
12 """log at NOTE level"""
13
14=== modified file 'ubuntuone/platform/linux/messaging.py'
15--- ubuntuone/platform/linux/messaging.py 2011-04-06 12:50:32 +0000
16+++ ubuntuone/platform/linux/messaging.py 2011-07-06 17:02:37 +0000
17@@ -22,13 +22,9 @@
18 # messages.
19
20 import dbus
21-import os
22 import subprocess
23-import sys
24
25 from time import time
26-from ubuntuone.logger import basic_formatter, logging
27-
28
29 try:
30 import indicate
31@@ -42,19 +38,10 @@
32 TRANSLATION_DOMAIN = 'ubuntuone-control-panel'
33
34 from ubuntuone.status.messaging import AbstractMessaging
35+from ubuntuone.status.logger import logger
36
37 APPLICATION_NAME = 'Ubuntu One Client'
38
39-LOG_LEVEL = logging.DEBUG
40-logger = logging.getLogger('ubuntuone.status')
41-logger.setLevel(LOG_LEVEL)
42-
43-if os.environ.get('DEBUG_STATUS'):
44- debug_handler = logging.StreamHandler(sys.stderr)
45- debug_handler.setFormatter(basic_formatter)
46- debug_handler.setLevel(LOG_LEVEL)
47- logger.addHandler(debug_handler)
48-
49
50 # pylint: disable=W0613
51 def open_volumes():
52
53=== modified file 'ubuntuone/status/aggregator.py'
54--- ubuntuone/status/aggregator.py 2011-06-24 21:37:58 +0000
55+++ ubuntuone/status/aggregator.py 2011-07-06 17:02:37 +0000
56@@ -20,14 +20,14 @@
57 import itertools
58 import operator
59 import os
60-import sys
61+
62
63 import gettext
64
65 from twisted.internet import reactor, defer
66
67 from ubuntuone.clientdefs import GETTEXT_PACKAGE
68-from ubuntuone.logger import basic_formatter, logging
69+from ubuntuone.status.logger import logger
70 from ubuntuone.platform import session
71 from ubuntuone.platform.notification import Notification
72 from ubuntuone.platform.messaging import Messaging
73@@ -36,16 +36,6 @@
74 ONE_DAY = 24 * 60 * 60
75 Q_ = lambda string: gettext.dgettext(GETTEXT_PACKAGE, string)
76
77-LOG_LEVEL = logging.DEBUG
78-logger = logging.getLogger('ubuntuone.status')
79-logger.setLevel(LOG_LEVEL)
80-
81-if os.environ.get('DEBUG_STATUS'):
82- debug_handler = logging.StreamHandler(sys.stderr)
83- debug_handler.setFormatter(basic_formatter)
84- debug_handler.setLevel(LOG_LEVEL)
85- logger.addHandler(debug_handler)
86-
87 UBUNTUONE_TITLE = Q_("Ubuntu One")
88 NEW_UDFS_SENDER = Q_("New cloud folder(s) available")
89 FINAL_COMPLETED = Q_("File synchronization completed.")
90
91=== added file 'ubuntuone/status/logger.py'
92--- ubuntuone/status/logger.py 1970-01-01 00:00:00 +0000
93+++ ubuntuone/status/logger.py 2011-07-06 17:02:37 +0000
94@@ -0,0 +1,36 @@
95+# ubuntuone.syncdaemon.logger - logging utilities
96+#
97+# Author: Guillermo Gonzalez <guillermo.gonzalez@canonical.com>
98+# Eric Casteleijn <eric.casteleijn@canonical.com>
99+#
100+# Copyright 2009-2011 Canonical Ltd.
101+#
102+# This program is free software: you can redistribute it and/or modify it
103+# under the terms of the GNU General Public License version 3, as published
104+# by the Free Software Foundation.
105+#
106+# This program is distributed in the hope that it will be useful, but
107+# WITHOUT ANY WARRANTY; without even the implied warranties of
108+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
109+# PURPOSE. See the GNU General Public License for more details.
110+#
111+# You should have received a copy of the GNU General Public License along
112+# with this program. If not, see <http://www.gnu.org/licenses/>.
113+""" SyncDaemon logging utilities and config. """
114+import logging
115+import os
116+
117+from ubuntuone.logger import (
118+ _DEBUG_LOG_LEVEL,
119+ LOGFOLDER,
120+ CustomRotatingFileHandler,
121+ basic_formatter)
122+
123+
124+LOGFILENAME = os.path.join(LOGFOLDER, 'status.log')
125+logger = logging.getLogger("ubuntuone.status")
126+logger.setLevel(_DEBUG_LOG_LEVEL)
127+handler = CustomRotatingFileHandler(filename=LOGFILENAME)
128+handler.setFormatter(basic_formatter)
129+handler.setLevel(_DEBUG_LOG_LEVEL)
130+logger.addHandler(handler)

Subscribers

People subscribed via source and target branches