Next Perpendicular Moonlanding

@namics/remlog-server

0.2.0 • Public • Published

@namics/remlog-server

Contents
const { Server } = require('@namics/remlog-server');

The server package is the main core for the remote logging process and provides you the API needed to trace logs immediately. There are a few endpoints you should know first:

  • / will give you an overview about all the logs happend in the current process
  • /info will show you the package name and version of the server instance
  • /trace is a HTTP POST route and will take the JSON body as trace payload
  • /tracer.jpg is a HTTP GET API and is implement by the @namics/remlog-browser-client package to provide a cross-browser method to log messages
  • /logs.json will return an array of JSON objects representing all your logs
  • /logs/<log-id>.json will show you a single log entry in JSON format

Examples

new require('@namics/remlog-server')
    .Server({
        port: 8123,
        transport: `@namics/remlog-transports/Console`, // default
        cors: ['*'] // default
    })
    .start();
new require('@namics/remlog-server')
    .Server({
        port: 9001,
        transport: `@namics/remlog-transports/FileSystem`,
        cors: ['my-domain.com', 'remote.namics.com'],
        // enables SSL on the server
        ssl: {
            key: './ssl/my-domain/key.pem',
            cert: './ssl/my-domain/cert.pem',
            passphrase: 'k12Sh1$£1e3^7VcaR#t'
        }
    })
    .start();

Sending a trace to the Server via AJAX

This uses the HTTP POST JSON API from the server exposed under the /trace route.

import axios from 'axios';
import { LOGLEVEL, getTraceUrl } from '@namics/remlog-utils';
 
const serverConfig = {
    host: '127.0.0.1',
    port: '<your-server-port>'
};
 
axios.post(getTraceUrl(serverConfig), {
    shortMessage: 'Hey you!',
    fullMessage: 'Blablabla',
    level: LOGLEVEL.INFO
});

Review the Changelog

install

npm i @namics/remlog-server

Downloadsweekly downloads

0

version

0.2.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
Report a vulnerability