byteSize(obj)

Returns the byte length of an utf8 string or an object (when parsed to JSON)

Parameters

  • obj :

chalk

Publicly export the chalk color library

cleanUrl(url)

Replace all (/.../g) leading slash (^\/) or (|) trailing slash (\/$) with an empty string.

Parameters

  • String url :

    URL / Path to cleanup

Returns

String

clearLogHistory

Clears (empties) the log object

colorize(msg)

Colors the messages by searching for specific indicator strings TODO: Allow to add to the colorMap

Parameters

Returns

string

debug(obj, silent)

Prints out debugging information for the current model object

Parameters

  • object obj :

    Object

  • silent :

error(obj, silent)

Prints errors

Parameters

  • object obj :

    Object

  • silent :

getConfig

Gets the current config

getDateArray([date])

Returns an array with date / time information Starts with year at index 0 up to index 6 for milliseconds

Parameters

  • [Date] date :

    Optional date object. If falsy, will take current time.

Returns

Array

getLogHistory

Returns the global.moboLogObject

Returns

Array

humanDate([date])

Returns nicely formatted date-time

Parameters

Returns

string

Examples

2015-02-10 16:01:12

humanTime([date])

Returns nicely formatted date-time

Parameters

Returns

string

Examples

16:01:12

log(msg, obj, [silent])

Custom Logging function

Writes Logs to console, stringifies objects first

Parameters

  • string or object msg :

    Message String or Object

  • obj :
  • [boolean] silent :

    Dot not print message to the console, but stores it to the log history.

pad(number, digits)

Pad a number with n digits

Parameters

  • number number :

    number to pad

  • number digits :

    number of total digits

Returns

string

prettyBytes(bytes, si)

Parameters

  • bytes :
  • si :

Returns

string

prettyNumber(number)

Adds dots as thousand separators to numbers

http://stackoverflow.com/a/2901298

Parameters

  • number :

Returns

string

roboDate([date])

Returns a formatted date-time, optimized for machines

Parameters

Returns

string

Examples

2015-02-10_16-00-08

roboTime([date])

Returns a formatted date-time, optimized for machines

Parameters

Returns

string

Examples

2015-02-10_16-00-08

stripTrailingSlash(url)

Strips trailing slashes from URL

Parameters

Returns

String

updateConfig(config)

Updates the config. Only those parameters that have been given will be updated

Parameters

semlog A semantic logger that colors and formats messages automatically according to the content