All Projects → Alorel → console-log-html

Alorel / console-log-html

Licence: LGPL-3.0 License
Adds console log output to the screen

Programming Languages

CSS
56736 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to console-log-html

badgee
Browser Console Improved
Stars: ✭ 26 (+4%)
Mutual labels:  logger, console-log
ptkdev-logger
🦒 Beautiful Logger for Node.js: the best alternative to the console.log statement
Stars: ✭ 117 (+368%)
Mutual labels:  logger, console-log
Lighty
Easy to use and lightweight logger for iOS, macOS, tvOS, watchOS and Linux in Swift.
Stars: ✭ 49 (+96%)
Mutual labels:  logger
ios logger
Application for camera and sensor data logging (iOS)
Stars: ✭ 60 (+140%)
Mutual labels:  logger
fluency
High throughput data ingestion logger to Fluentd, AWS S3 and Treasure Data
Stars: ✭ 135 (+440%)
Mutual labels:  logger
printer
A fancy logger yet lightweight, and configurable. 🖨
Stars: ✭ 65 (+160%)
Mutual labels:  logger
nunit.testlogger
NUnit logger for vstest platform
Stars: ✭ 48 (+92%)
Mutual labels:  logger
polog
Логирование должно быть красивым
Stars: ✭ 26 (+4%)
Mutual labels:  logger
esp-logger
An Arduino library providing a minimal interface to log data on flash memory and SD cards with ESP8266 and ESP32
Stars: ✭ 40 (+60%)
Mutual labels:  logger
tlf
TLF - a console based ham radio contest logger
Stars: ✭ 41 (+64%)
Mutual labels:  logger
logger sentry
Elixir Logger backend for Sentry
Stars: ✭ 20 (-20%)
Mutual labels:  logger
laravel-slow-query-logger
Slow Query Logger for Laravel 5.6
Stars: ✭ 27 (+8%)
Mutual labels:  logger
slack logger backend
An Elixir logger backend for posting errors to Slack.
Stars: ✭ 31 (+24%)
Mutual labels:  logger
winston-telegram
A Telegram transport for winston
Stars: ✭ 28 (+12%)
Mutual labels:  logger
ip-logger
📇 When someone clicks the link, you will receive their IP and other information via telegram.
Stars: ✭ 0 (-100%)
Mutual labels:  logger
awesome-automotive-can-id
🚜 unpretentious attempt to collect CAN IDs and payloads for various car brands/models in one place.
Stars: ✭ 104 (+316%)
Mutual labels:  logger
qml-logger
Plugin for file logging from QML
Stars: ✭ 17 (-32%)
Mutual labels:  logger
horse-logger
Middleware for access logging in HORSE
Stars: ✭ 25 (+0%)
Mutual labels:  logger
koa2-winston
koa2 version winston logger like express-winston
Stars: ✭ 37 (+48%)
Mutual labels:  logger
egg-logger-sls
Logger transport for aliyun sls.
Stars: ✭ 14 (-44%)
Mutual labels:  logger

A tiny library that overrides the browser's console.* functions allowing the logged messages to be displayed in HTML.

Coverage Status Build Status Deps Deps

NPM

Migrating from 1.x to 2.0? See MIGRATING.md

Installation:

Simply include the file on your page:

<script type="application/javascript" src="console-log-html.min.js"></script>
<!-- Or, alternatively, use the CDN URL -->
<script type="application/javascript" src="//cdn.rawgit.com/Alorel/console-log-html/master/console-log-html.min.js"></script>

It can also be included as a dependency from npm:

npm install console-log-html --save
(function(){ // Your closure
    var ConsoleLogHTML = require('console-log-html');
})();

Usage:

    <ul id="myULContainer"></ul> <!-- I will hold the log messages -->
    <script type="application/javascript" src="console-log-html.min.js"></script>
    <script>
        ConsoleLogHTML.connect(document.getElementById("myULContainer")); // Redirect log messages
        ConsoleLogHTML.disconnect(); // Stop redirecting
    </script>

You can also instruct the script to only log to the console by passing a second argument to console.*(), e.g.:

console.log("foo"); // Logs "foo" to HTML
console.log("Look, some JSON:", {foo: 'bar'}); // Logs "Look, some JSON: Object {"foo":"bar"}" to HTML
console.skipHtml.log("bar"); // Logs only to the console

Customisation

Default styles

The default css classes can be overriden in ConsoleLogHTML.DEFAULTS:

    ConsoleLogHTML.DEFAULTS.error = "some-error-css-class"; // Will be applied to console.error()
    ConsoleLogHTML.DEFAULTS.log = "another-override"; // Will be applied to console.log()

During connect()

The connect method has the following signature:

function connect(target, options, includeTimestamp, logToConsole, appendAtBottom){}
  • target has already been covered - it's the <ul> element
  • options allows you to override the css classes in ConsoleLogHTML.DEFAULTS for the duration of the connect, i.e. it would not save the values. For example, if you wanted to override the log and warn CSS classes you could pass the object
{
     "warn": "my-warn-css-class",
     "log": "my-log-css-class"
}
  • includeTimestamp - when set to true (the default value), a timestamp will be prepended to each message as it appears in the <ul>. The timestamp's format depends on the user as it is created via
(new Date()).toLocaleTimeString()
  • logToConsole - when set to true (the default value), appear both in the console and the <ul>; when set to false, they appear only in the <ul>.
  • appendAtBottom - when set to true (default=false), log messages will be appended at the end of the <ul>-list.

More information:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].