Usage

Basics

First, you need to create a logger manually or through a config. You can then reach it through indexes, just like dictionnaries, and call a defined level.

test = Journal()
test.add_log(name = "new")
test["new"].info("this is a test ")

Levels

They can be created before or after loggers and can be called like all other levels.

Warning

When creating new level, make sure neither the name or the value is already used or else unpredictable behavior can occur.

test.add_level("Mylevel", 29)
test["new"].Mylevel( "this is an important message" )

Config

To add configs, it is recommanded to use the gen_config and gen_handler

handler = gen_handler( "logs/cat_traceback.log" , "file" , 18 )
config = gen_config( "cat" , level = 10 , loggers = [ "black" , "white" ] , handlers = handler)
#since no format was indicated , it will use the defaut's config one
test.add_config( config )
test["black"].Mylevel(" this is using logger generated through config ")

Handlers

Handlers are created via add_log. You can define which config to use, otherwise it will use the default one.

test.add_log( name = "mixed" , config = "cat")
test["mixed"].warning("this cat is strange")