openjslog v1.0.0
OpenJSLog
OpenJSLog is a sophisticated Logging utility with Timestamping and Log-Analysis.
It is based on JSON-Explorer by kadjar: https://github.com/kadjar/json-explorer
Now with Node.JS support & MIT Licensed!
Usage
Node.JS:
A simple
npm install openjslogwithin you commandline (or adding a dependency toopenjslogin yourpackage.jsonfolloweg by a simplenpm install) and avar Log = require('openjslog');in your application suffices to be able to useLog(myAwesomeVariable);Available methods: (
Logwill be the name of your variable!)Log(log, force, spit, emptyAfterSpit)Log.Group(groupName, collapsed)Log.GroupEnd()Log.toString()
Browser:
Simply include the file somewhere in your html and use one of the following available methods:
Log(log, force, spit, emptyAfterSpit)Log.group(groupName, collapsed)Log.groupEnd()Log.toString()Log.setDevmode(value)
Code-docs:
Log(log, force, spit, emptyAfterSpit):
Log: Logs the given input with a timestamp
@param log The Object to log.
@param force Whether or not to force a log to console.
@param spit Output the Logbuffer to the Console
@param emptyAfterSpit Wether or not to empty the Logbuffer after outputting it.Log.setDevmode(value): (Unavailable in Node.JS, legacy available via OJSLsetDevmode(...))
Log.setDevmode: Sets the devmode to either true or false
@param value true or falseLog.group(groupName, collapsed): (legacy available via OJSLGroup(...))
Log.group: Marks the beginning of a group of logs
@param groupName The name of the group
@param collapsed Collapse the Group?Log.groupEnd(): (legacy available via OJSLGroupEnd())
Log.group: Marks the end of a group of logsLog.toString():
Log.toString: Return the contents of the LogBuffer as JSON
@returns string Contents of the LogBuffer as JSON