How to use the WMLogger's instance

Sometimes is necesary to show some information using the console, but it's important to have under control what is shown; WMLogger's instance is a custom logger that allows you to control the sensibility and levels to show, so follow this guide in order to use it correctly.

1. Import the module

You can use the next line:

import { WMLogger } from '@mobilize/logging';

2. Using methods

WMLogger has 4 methods that can be used to log information, these are the next ones:

const msg = "LOG MESSAGE";

WMLogger.instance().debug(msg);
WMLogger.instance().info(msg);
WMLogger.instance().warn(msg);
WMLogger.instance().error(msg);

Every method will log the message in a different level, being this levels:

  • DEBUG

  • INFO

  • WARN

  • ERROR