Logging Done Simple
Install
npm install logging-done-simple
Import && Create logging group name
import Logger from 'logging-done-simple';
const logger = Logger("Group Name");
Use logger to log to console.
.info() and .log() will not show up on production builds.
logger.info("message goes here" , {id: 1, name: "some name"}, "messageTitle");
You can log just a single object. Or a object array
logger.log("message goes here" , [this.state, this.props],
"messageTitle");
Arguments are as follows.
logger.log(message: string, objects: null | {} | {}[] = null, title: string)
You don't have to pass a object.
logger.info("message", null, "title");
Console example
Warning and errors do show up on production builds.
Write you own styles
logger.setStyle("styleType", "string of styles");
Style Types = "error", "info", "log", "warning", and "group" to style the group name
Error and Warning styles only apply to objects in the warning and error calls
String of styles = "; seperated list of css properties"
Example
logger.setStyle("error", "background-color: red; color: white; margin-left: 2rem");