def __init__(self, routes_module, address='0.0.0.0', port=8866, logging_level=loggus.INFO): loggus.SetLevel(logging_level) loggus.info('Server Start ...') loggus.info('Server Address is %s:%d' % (address, port)) self.address = address self.port = port self.middleware_manager = middleware_manager self.add_routes(routes_module)
import loggus if __name__ == '__main__': loggus.info("hello world") loggus.WithFields({ "name": "cza" }).WithFields({ "age": 18 }).info("hello world") loggus.info("hello world") loggus.SetFormatter(loggus.JsonFormatter) loggus.info("hello world") loggus.WithFields({ "name": "cza" }).WithFields({ "age": 18 }).info("hello world") loggus.info("hello world") log = loggus.NewLogger() log.info("hello world") log.WithFields({"name": "cza"}).WithFields({"age": 18}).info("hello world") log.info("hello world")
def loop(index): loggus.info(index)
def test(): for i in range(5): loggus.info("hello world") loggus.warning("hello world") loggus.error("hello world") time.sleep(3)
def loop(index): time.sleep(0.5) loggus.info(index)
import loggus if __name__ == '__main__': loggus.info() loggus.info("hello", "world") loggus.info({"hello": "world"}) loggus.info({"hello": "world"}, "o") loggus.info("hello world", {"hello": "world"}, ["hello", "world"], {"hello", "world"}, ("hello", "world"))