0.1.13 • Published 7 months ago

@logstream/logstream v0.1.13

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

@logstream/logstream

This is a TypeScript client library for logstream. It allows you to log information from your JavaScript applications to your logstream server directly.

Installation

npm install @logstream/logstream

Importing Logstream

Firstly, you would need to import the Logstream from the @logstream/logstream library.

import { Logstream } from "@logstream/logstream";

Initializing Logstream

To initialize logstream, create a new instance of Logstream. As an argument, you need to pass the forwarding URL to your logstream organisation.

const logstream = new Logstream("https://logstream.ai/v1/stdin?token=123..");

Creating a Log Channel

Next, create a new Log Channel using the channel method of the logstream object and passing in the channel name.

const channel = logstream.channel("Test log");

Logging Data

The log data can be of any data type including objects and arrays.

channel.log({
  address: {
    street: "123 Main St",
    city: "Exampleville",
  },
});

Logging Errors

To log errors, use the built-in functions: warn, error, and critical.

channel.warn(new Error("This is a warning message"));
channel.error(new Error("This is an error message"));
channel.critical(new Error("This is a critical message"));

The warn, error, and critical functions each represent different levels of esception and they work similarly to the log function.

0.1.13

7 months ago

0.1.12

7 months ago

0.1.10

7 months ago

0.1.9

7 months ago

0.1.8

7 months ago

0.1.7

7 months ago

0.1.6

7 months ago

0.1.5

7 months ago

0.1.4

7 months ago

0.1.3

7 months ago

0.1.2

7 months ago

0.1.1

7 months ago

0.1.0

7 months ago