File: logger.py

package info (click to toggle)
python-ldap 3.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,248 kB
  • sloc: python: 9,465; ansic: 2,828; makefile: 132; sh: 68
file content (19 lines) | stat: -rw-r--r-- 388 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# -*- coding: utf-8 -*-
"""
Helper class for using logging as trace file object
"""

import logging

class logging_file_class(object):

    def __init__(self, logging_level):
        self._logging_level = logging_level

    def write(self, msg):
        logging.log(self._logging_level, msg[:-1])

    def flush(self):
        return

logging_file_obj = logging_file_class(logging.DEBUG)