From 46d3e251a33b0f678ee0cc0b2253b5dd9abeb695 Mon Sep 17 00:00:00 2001 From: John Gaunt Date: Tue, 12 Oct 2021 10:31:40 -0400 Subject: [PATCH] added log level to config and commented code for starting the log --- config.ini.sample | 5 +++++ seafile-ldap.py | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/config.ini.sample b/config.ini.sample index b197058..50374ea 100644 --- a/config.ini.sample +++ b/config.ini.sample @@ -1,3 +1,8 @@ +#default Section +[DEFAULT] +# debug, info, warning, error, critical +logLevel = INFO + # this section contains information related to the server [LDAP SERVER] server = ad.sample.com diff --git a/seafile-ldap.py b/seafile-ldap.py index 29718e1..5903a1f 100644 --- a/seafile-ldap.py +++ b/seafile-ldap.py @@ -3,6 +3,17 @@ from ldap3 import Connection, Server, ANONYMOUS, SIMPLE, SYNC, ASYNC from getpass import getpass import configparser +import logging + +#logger = logging.getLogger(__main__) +#logger.setLevel(logging.INFO) + +#logging.basicConfig(level=logging.INFO,format='%(asctime)s - [%(levelname)s] %(message)s', datefmt='%Y-%m-%d %H:%M:%S') + +#logLevel = config['DEFAULT']['logLevel'] +#logLevel = debug + +#logging.basicConfig(level=logging.logLevel,format='%(asctime)s - [%(levelname)s] %(message)s', datefmt='%Y-%m-%d %H:%M:%S') # import the config file config = configparser.ConfigParser()