Socket
Book a DemoInstallSign in
Socket

@namics/remlog-server

Package Overview
Dependencies
Maintainers
7
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@namics/remlog-server

###### Contents

latest
Source
npmnpm
Version
0.3.2
Version published
Maintainers
7
Created
Source

@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

Keywords

remote

FAQs

Package last updated on 10 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts