Giter Site home page Giter Site logo

cybernetics / loglevel-serversend Goto Github PK

View Code? Open in Web Editor NEW

This project forked from artemyarulin/loglevel-serversend

0.0 1.0 0.0 128 KB

Plugin for loglevel JS lib which will forward all log messages to the server

License: MIT License

JavaScript 100.00%

loglevel-serversend's Introduction

Plugin for JS logger loglevel which will forward all log messages to the server

Features

  • Send is async and wouldn't slow down the application
  • Messages send one by one, so the order is maintained
  • Any server which accept POST request should be supported
  • You can specify prefix function which would dynamically add prefix for all log messages (app name, current user, etc.)

Installation

Configuration

Add loglevel and loglevel-serverSend scripts to your page first. Then configure the plugin:

##loglevelServerSend(logger, options) Extend loglevel with new plugin which will send log information to the log-sever

Param Type Description
logger object loglevel instance to be extended
options object
[options.url='http://localhost:8000/main/log'] string Server url which would be used as a log server
[options.prefix=null] string | function Prefix for all log messages. Either string or function wich should return string and accept log severity and message as parameters
[options.callOriginal=false] Bool If set to true - original loglevel method for logging would be called

Example

loglevelServerSend(log,{url:'https://example.com/app/log',prefix: function(logSev,message) {
    return '[' + new Date().toISOString() + '] ' + logSev + ': ' + message + '\n'   
}})

Servers

It should be fairly easy to create a server which will store all the log messages, but most probably node-log-server would be good enough for you

loglevel-serversend's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.