util-logging

Simple logging based on the design of java.util.logging

Usage no npm install needed!

<script type="module">
  import utilLogging from 'https://cdn.skypack.dev/util-logging';
</script>

README

util-logging

Usage:

//load the module
var log = require("util-logging");

//create a logger, and set its logging level
var logger =  new log.ConsoleLogger().setLevel(log.Level.INFO);

//log some a simple message 
logger.info("Message at info level");

//log an error by itself
logger.info(new Error("Cannot compute!"));

//log and error accompanied by a message
logger.info("An error has occurred!", new Error("Cannot compute!"));

//log an object
logger.info({"key1": "value1"});

//log a formatted message
logger.info("Today is %s", new Date());

//log a formatted message with multiple replacements
logger.info("Hello %s, and %s", "foo", "bar");