Merge lp:~mandel/ubuntuone-client/fs-darwin-logging into lp:ubuntuone-client

Proposed by Manuel de la Peña
Status: Merged
Merged at revision: 1296
Proposed branch: lp:~mandel/ubuntuone-client/fs-darwin-logging
Merge into: lp:ubuntuone-client
Diff against target: 53 lines (+11/-1)
1 file modified
ubuntuone/platform/filesystem_notifications/monitor/__init__.py (+11/-1)
To merge this branch: bzr merge lp:~mandel/ubuntuone-client/fs-darwin-logging
Reviewer Review Type Date Requested Status
Mike McCracken (community) Disapprove
Review via email: mp+121466@code.launchpad.net

Commit message

- Added extra logging to know the fs monitor implementation used (LP: #1042336).

Description of the change

- Added extra logging to know the fs monitor implementation used (LP: #1042336).

To post a comment you must log in.
Revision history for this message
Mike McCracken (mikemc) wrote :

This didn't work for me - I couldn't find the output anywhere.
I changed it to import logger from ubuntuone.syncdaemon and write the messages with logger.root_logger.debug(), then I got output in syncdaemon.log, which is where I was expecting it…

review: Needs Fixing
Revision history for this message
Mike McCracken (mikemc) wrote :

fixed elsewhere branched from this code

review: Disapprove

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/platform/filesystem_notifications/monitor/__init__.py'
2--- ubuntuone/platform/filesystem_notifications/monitor/__init__.py 2012-08-01 14:25:58 +0000
3+++ ubuntuone/platform/filesystem_notifications/monitor/__init__.py 2012-08-27 17:10:24 +0000
4@@ -28,12 +28,14 @@
5 # files in the program, then also delete it here.
6 """Filesystem monitors per platform."""
7
8+import logging
9 import sys
10
11 from twisted.internet import defer
12
13 DEFAULT_MONITOR = 'default'
14-
15+logger = logging.getLogger('ubuntuone.platform.filesystem_notifications'
16+ + '.monitor')
17
18 class NoAvailableMonitorError(Exception):
19 """Raised if there are no available monitors in the system."""
20@@ -70,6 +72,9 @@
21 DEFAULT_MONITOR: linux.FilesystemMonitor,
22 }
23
24+logger.debug('File monitor ids for platform "%s" are "%s"', sys.platform,
25+ FILEMONITOR_IDS)
26+
27 # mantain old API
28 FilesystemMonitor = FILEMONITOR_IDS[DEFAULT_MONITOR]
29
30@@ -78,6 +83,7 @@
31 def get_filemonitor_class(monitor_id=None):
32 """Return the class to be used."""
33 if monitor_id is None:
34+ logger.debug('monitor_id is None, using platforms default monitor.')
35 # use default
36 monitor_id = 'default'
37
38@@ -87,11 +93,15 @@
39
40 # retrieve the correct class and assert it can be used
41 cls = FILEMONITOR_IDS[monitor_id]
42+ logger.debug('Monitor class to use %s', cls)
43 is_available = yield cls.is_available_monitor()
44
45 if is_available:
46+ logger.debug('Monitor is available, returning monitor with id "%s"',
47+ monitor_id)
48 defer.returnValue(cls)
49 elif not is_available and monitor_id != DEFAULT_MONITOR:
50+ logger.debug('Monitor is NOT available, returning default monitor.')
51 cls = yield get_filemonitor_class(DEFAULT_MONITOR)
52 defer.returnValue(cls)
53 else:

Subscribers

People subscribed via source and target branches