~ubuntu-branches/ubuntu/precise/ubuntuone-client/precise-201112142106

« back to all changes in this revision

Viewing changes to ubuntuone/status/logger.py

  • Committer: Bazaar Package Importer
  • Author(s): Rodney Dawes
  • Date: 2011-08-09 12:47:56 UTC
  • mfrom: (1.1.53 upstream)
  • Revision ID: james.westby@ubuntu.com-20110809124756-7nzilp3oix0a1yl9
Tags: 1.7.1-0ubuntu1
* New upstream release.
* debian/*:
  - Removed obsolete pycompat file
  - Removed ubuntuone-client-gnome deps and binary packaging, as it was
    moved out to separate project upstream.
  - Updated copyright to remove obsolete file reference
* debian/patches:
  - Removed patches which have been included upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# ubuntuone.syncdaemon.logger - logging utilities
 
2
#
 
3
# Author: Guillermo Gonzalez <guillermo.gonzalez@canonical.com>
 
4
#         Eric Casteleijn <eric.casteleijn@canonical.com>
 
5
#
 
6
# Copyright 2009-2011 Canonical Ltd.
 
7
#
 
8
# This program is free software: you can redistribute it and/or modify it
 
9
# under the terms of the GNU General Public License version 3, as published
 
10
# by the Free Software Foundation.
 
11
#
 
12
# This program is distributed in the hope that it will be useful, but
 
13
# WITHOUT ANY WARRANTY; without even the implied warranties of
 
14
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
15
# PURPOSE.  See the GNU General Public License for more details.
 
16
#
 
17
# You should have received a copy of the GNU General Public License along
 
18
# with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
 
 
20
"""SyncDaemon logging utilities and config."""
 
21
 
 
22
import logging
 
23
import os
 
24
 
 
25
from ubuntuone.logger import (
 
26
    _DEBUG_LOG_LEVEL,
 
27
    basic_formatter,
 
28
    CustomRotatingFileHandler,
 
29
)
 
30
 
 
31
from ubuntuone.platform.xdg_base_directory import ubuntuone_log_dir
 
32
 
 
33
 
 
34
LOGFILENAME = os.path.join(ubuntuone_log_dir, 'status.log')
 
35
logger = logging.getLogger("ubuntuone.status")
 
36
logger.setLevel(_DEBUG_LOG_LEVEL)
 
37
handler = CustomRotatingFileHandler(filename=LOGFILENAME)
 
38
handler.setFormatter(basic_formatter)
 
39
handler.setLevel(_DEBUG_LOG_LEVEL)
 
40
logger.addHandler(handler)