@beefoio/file.log

file.log is a logger that logs to an file

Usage no npm install needed!

<script type="module">
  import beefoioFileLog from 'https://cdn.skypack.dev/@beefoio/file.log';
</script>

README

file.log

Log things, prefixed with a timestamp, to a file (./log/debug.log, ./log/datetime_logger.log)

Usage

var logger = require('@beefoio/file.log');

logger.enableConsoleOutput();
// enables printout to console

logger.setLevel('info');
// sets the level to info or higher

logger.info('an info');
// [07.10.2018 22:23:34] info: an info

API

logger.setLevel(level)

Set the Log-Level to the level and only things on that level or higher will get logged

logger.trace(msg...)

Logs the message in the format: [dd.mm.YYYY HH:MM:ss] trace: msg... to the files and optional to the console

logger.debug(msg...)

Logs the message in the format: [dd.mm.YYYY HH:MM:ss] debug: msg... to the files and optional to the console

logger.info(msg...)

Logs the message in the format: [dd.mm.YYYY HH:MM:ss] info: msg... to the files and optional to the console

logger.warn(msg...)

Logs the message in the format: [dd.mm.YYYY HH:MM:ss] warn: msg... to the files and optional to the console

logger.error(msg...)

Logs the message in the format: [dd.mm.YYYY HH:MM:ss] error: msg... to the files and optional to the console

logger.fatal(msg...)

Logs the message in the format: [dd.mm.YYYY HH:MM:ss] fatal: msg... to the files and optional to the console

License

GPL-3.0