allow multiple message arguments and add version info

This commit is contained in:
Izalia Mae 2020-03-11 08:02:28 -04:00
parent 7e2ef01818
commit 1314693ab0
3 changed files with 27 additions and 18 deletions

View file

@ -6,3 +6,6 @@ https://git.barkshark.xyz/izaliamae/izzylib
import sys
assert sys.version_info >= (3, 6)
__version__ = (0, 1, 1)

View file

@ -79,7 +79,7 @@ class Log():
stdout.flush()
def log(self, level, msg):
def log(self, level, *msg):
'''log to the console'''
levelNum = self._lvlCheck(level)
@ -91,7 +91,8 @@ class Log():
if levelNum < self.config['level']:
return
output = f'{level}: {msg}\n'
message = ' '.join(msg)
output = f'{level}: {message}\n'
if self.config['date'] and (self.config['systemd'] and not env.get('INVOCATION_ID')):
'''only show date when not running in systemd and date var is True'''
@ -102,26 +103,26 @@ class Log():
stdout.flush()
def critical(self, msg):
self.log('CRIT', msg)
def critical(self, *msg):
self.log('CRIT', *msg)
def error(self, msg):
self.log('ERROR', msg)
def error(self, *msg):
self.log('ERROR', *msg)
def warning(self, msg):
self.log('WARN', msg)
def warning(self, *msg):
self.log('WARN', *msg)
def info(self, msg):
self.log('INFO', msg)
def info(self, *msg):
self.log('INFO', *msg)
def verbose(self, msg):
self.log('VERB', msg)
def verbose(self, *msg):
self.log('VERB', *msg)
def debug(self, msg):
self.log('DEBUG', msg)
def debug(self, *msg):
self.log('DEBUG', *msg)
def merp(self, msg):
self.log('MERP', msg)
def merp(self, *msg):
self.log('MERP', *msg)
def getLogger(loginst, config=None):

View file

@ -2,10 +2,15 @@
from setuptools import setup
import sys
from IzzyLib import __version__ as v
version = '.'.join([str(i) for i in v])
setup(
name="IzzyLib",
version='0.1',
version=version,
packages=['IzzyLib'],
python_requires='>=3.6.0',
install_requires=[req.replace('\n', '') for req in open('requirements.txt').readlines()],
@ -13,7 +18,7 @@ setup(
author='Zoey Mae',
author_email='admin@barkshark.xyz',
description='a collection of often-used functions and classes',
keywords='web http server',
keywords='web http server database postgresql',
url='https://git.barkshark.xyz/izaliamae/izzylib',
project_urls={
'Bug Tracker': 'https://git.barkshark.xyz/izaliamae/izzylib/issues',