outlog
Outlog it's a library to make logging a simple task!.
I'm a lazy python user, the times that i do logging on my apps it's hard to do, a lot of useless code just for print some things or saving to files
So i made this library, it has some functions to log data in terminal or files and catch unexpected errors in the easiest way.
Really simple to use!
How-to Install
git clone https://github.com/zsendokame/outlog; cd outlog; pip install -e .
How-to Use
This is a little tutorial!.
Messages
from outlog import message
message.debug('DEBUG Message') # Debug Message - Blue
message.info('INFO Message') # Info Message - Black
message.warn('WARN Message') # Warn Message - Yellow
message.error('ERROR Message') # Error Message - Light red
message.critical('CRITICAL Message', 1) # Critical Message, second argument is used to know what command status code put on exit - Red
File logging
import outlog.logging as logging
logging.logger.createLogger('Log.file.log') # Create logger and pass the filename to use
logging.save('LOG Type', 'LOG Message') # Save logs into the file, Log type (Debug, Info, Warning and Etc...) and the log message
logging.killLogger() # If logger it's killed the file is going to die
Error catching
from outlog import error
@error.catch
def error():
print('Concatenate STR with INT' + 1)
1 / 0 # Divide for 0
# Do whatever you wan't, all kind of errors!
print('And i\'m still alive!')