optimuslib 0.0.48__tar.gz → 0.0.49__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: optimuslib
3
- Version: 0.0.48
3
+ Version: 0.0.49
4
4
  Summary: Function Library for mostly used codes
5
5
  Author: Shomi Nanwani
6
6
  Requires-Python: >=3.9,<4.0
@@ -99,33 +99,27 @@
99
99
  import logging
100
100
 
101
101
  # Creating logger
102
- # logging.basicConfig(level=logging.DEBUG)
103
- # logging.basicConfig(level=logging.DEBUG, filename='logs.txt', format='%(asctime)s - %(levelname)s - %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
104
- # logging.basicConfig(level=logging.DEBUG, filename='logs.txt', format='%(asctime)s — %(name)s — %(levelname)s — %(funcName)s:%(lineno)d — %(message)s', datefmt='%d-%b-%y %H:%M:%S')
105
102
  log = logging.getLogger(__name__)
106
103
  log.setLevel(logging.DEBUG)
107
- # log.setLevel(logging.INFO)
108
104
 
109
- # # Handler - 1
105
+ # Handler - 1: File Handler
110
106
  file = logging.FileHandler('optimuslibLogs.log', 'a', 'utf-8')
111
- # fileformat = logging.Formatter(fmt='%(asctime)s - %(levelname)s - %(filename)s - %(module)s:%(funcName)s - %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
112
107
  fileformat = logging.Formatter(fmt='%(asctime)s | %(levelname)s | %(filename)s | %(funcName)s | %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
113
108
  file.setLevel(logging.DEBUG)
114
- # file.setLevel(logging.INFO)
115
109
  file.setFormatter(fileformat)
116
110
 
117
- # # Handler - 2
111
+ # Handler - 2: Stream Handler
118
112
  stream = logging.StreamHandler()
119
- # streamformat = logging.Formatter(fmt='%(asctime)s - %(levelname)s - %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
120
- streamformat = fileformat
121
113
  stream.setLevel(logging.DEBUG)
122
- # stream.setLevel(logging.INFO)
123
- stream.setFormatter(streamformat)
114
+ stream.setFormatter(fileformat)
124
115
 
125
- # # Adding all handlers to the logs
116
+ # Adding handlers to the logger (not to root logger to avoid duplicates)
126
117
  log.addHandler(file)
127
118
  log.addHandler(stream)
128
119
 
120
+ # Prevent propagation to root logger to avoid duplicate logs
121
+ log.propagate = False
122
+
129
123
  def loglib(data):
130
124
  log.info(data)
131
125
  log.info('%d %s','1', 'a')
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "optimuslib"
3
- version = "0.0.48"
3
+ version = "0.0.49"
4
4
  description = "Function Library for mostly used codes"
5
5
  authors = ["Shomi Nanwani"]
6
6
  readme = "README.md"
File without changes