GitHub - ksankumar/logger.js: Get all console logs into screen without opening console/developer mode.

Logger is a lightweight pure Javascript library, it helps for Get the all console logs into browser screen window without opening console/developer mode

Version

v1.0.1

Installation

You need Gulp installed globally:

$ git clone https://github.com/ksankumar/logger.js
<script type="text/javascript" src="lib/logger.min.js"></script>

Example

Screenshot

Browser Support

Logger.js works on most all kind of browsers latest versions.

  • Google Chrome
  • Firefox
  • Safari
  • IE
  • Opera

Logger.js API

ready

If you want to render logger if before DOM ready or within , use this API

logger.ready(function(l) {
    l.log("logger.log");
    l.info("logger.info");
});

init

If you want to render loggerwithin , use this API

logger.init({'bgColor':'tomato', 'direction':'top_right'});
  • options
    • directions - positions for logger window (top_left/top_right/bottom_left/bottom_right)
    • bgColor - background color

Initializing the logger screen window.

On

Show the logger screen window if is turned off.

Off

Hide the displaying logger screen window.

kill

Destroy the logger screen window if it's created.

Position

logger.position({'direction':'bottom_right'});

Change the logger screen window position.

log

For general output of logging information. You may use string substitution and additional arguments with this method.

warn

Outputs a warning message. You may use string substitution and additional arguments with this method

error

logger.error('Opps.. Error');

Outputs an error message. You may use string substitution and additional arguments with this method.

dir

Displays an interactive listing of the properties of a specified JavaScript object. This listing lets you use disclosure triangles to examine the contents of child objects.

dirxml

Displays an XML/HTML Element representation of the specified object if possible or the JavaScript Object view if it is not

group

Creates a new inline group, indenting all following output by another level. To move back out a level, call groupEnd().

groupCollapsed

logger.groupCollapsed(object);

Creates a new inline group, indenting all following output by another level; unlike group(), this starts with the inline group collapsed, requiring the use of a disclosure button to expand it. To move back out a level, call groupEnd().

groupEnd

Exits the current inline group.

profile

Starts the browser's build-in profiler (for example, the Firefox performance tool). You can specify an optional name for the profile.

profileEnd

Stops the profiler. You can see the resulting profile in the browser's performance tool

table

Displays tabular data as a table.

time

Starts a timer with a name specified as an input parameter. Up to 10,000 simultaneous timers can run on a given page.

timeEnd

Stops the specified timer and logs the elapsed time in seconds since its start.

timeStamp

Adds a marker to the browser's Timeline or Waterfall tool.

trace

Outputs a stack trace.

assert

logger.assert(expression, object);

Log a message and stack trace to console if first argument is false.

count

Log the number of times this line has been called with the given label.

debug

Writes a message to the console, including a hyperlink to the line where it was called.

exception

logger.exception(object);

Prints an error message together with an interactive stack trace of JavaScript execution at the point where the exception occurred.object

clear

Clears the console.

About

And of course ksankumar itself is open source with a [public repository][ksankumar] on GitHub.

Reference

Firefox Console API

Chrome Console API

License

Copyright (c) 2016 Santhosh Kumar Krishnan Licensed under the MIT license.