MCPcopy Create free account
hub / github.com/detro/consoleplusplus / _formatMessage

Function _formatMessage

console++.js:170–186  ·  view source on GitHub ↗
(msg, levelMsg)

Source from the content-addressed store, hash-verified

168 * @retuns The formatted message
169 */
170var _formatMessage = function(msg, levelMsg) {
171 var printLevelMsg = console.isLevelMsgPrinted(),
172 printTimestamp = console.isTimestamped(),
173 formatted;
174
175 if (printLevelMsg && printTimestamp) {
176 formatted = "[" + levelMsg + " - " + new Date().toJSON() + "] " + msg;
177 } else if (printLevelMsg) {
178 formatted = "[" + levelMsg + "] " + msg;
179 } else if (printTimestamp) {
180 formatted = "[" + new Date().toJSON() + "] " + msg;
181 } else {
182 formatted = msg;
183 }
184
185 return formatted;
186};
187
188/**
189 * Invokes the "console.onOutput()" callback, if it was set by user.

Callers 2

_decorateArgsFunction · 0.85
_invokeOnOutputFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected