Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including logbin with all npm packages installed. Try it out:

'use strict'; let Logbin = require( 'logbin' ); // Config for Logger let config = { store: 'logbin-sample', token: 'anyTokenIsValidForNow', host: 'ec2-52-196-108-147.ap-northeast-1.compute.amazonaws.com' }; let logger = new Logbin( config ); let levels = [ 'error', 'warn', 'info', 'verbose', 'debug', 'silly' ], animals = [ 'dog', 'cat', 'squid', 'octopus', 'giraffe', 'elephant' ], logLimit = 20; let logSent = 0; // Send random logs... setInterval( function() { let level = getRandom( levels ); let animal = getRandom( animals ); logger.log( level, { animal: animal, say: `My log level is ${level}` } ); console.log( `${animal} is sending a log with level: ${level}` ); if ( logSent++ === logLimit ) { process.exit( 0 ); } }, 1000 ); function getRandom ( array ) { let index = Math.floor( Math.random() * array.length ); return array[ index ]; } // Config for LogStream config.level = 'info'; // Only receive logs with levels error, warn, and info var logStream = new Logbin.LogStream( config ); logStream.on( 'log', function( data ) { console.log( `Received log: ${JSON.stringify( data )}` ); } );

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

logbin v1.3.8

NodeJS client for logbin.io

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free