Welcome to Cabin: Your Self-hosted Logging Service

Dec 4, 2023 | Programming


Cabin is the best self-hosted JavaScript and Node.js logging service.

Supports Node v14+, Browser Environments, Express, Koa, and Lass.

Table of Contents

Foreword

Cabin is a layer on top of Axe that provides automatic logging for route middleware requests and errors. For more insight, please check the documentation.

Quick Start

To get started with Cabin, you need to install it along with Express or Koa. Here’s a quick setup:

npm install express axe cabin signale
const express = require('express');
const Axe = require('axe');
const Cabin = require('cabin');
const Signale = require('signale');
const app = express();

// Initialize a new instance of Axe
const logger = new Axe({ logger: new Signale() });

// Initialize Cabin with the Axe logger instance
const cabin = new Cabin(logger);

// Initialize route logging middleware
app.use(cabin.middleware);

// A simple route
app.get('/', (req, res) => res.send('OK'));

// Start the server
app.listen(3000, () => cabin.info('App started'));

Features

Cabin comes with numerous features designed to enhance your logging experience:

  • Automatic detection and masking of sensitive data (e.g., credit card numbers, JWTs).
  • Reduce disk storage costs by converting unreadable objects into simple, descriptive forms.
  • Compatible with popular Node.js HTTP frameworks like Express and Koa.

Install

Note: As of v11.0.0, Cabin requires a peer dependency of Axe to be installed.

npm install cabin axe

Usage

Here’s how you can use Cabin in your applications:

const Cabin = require('cabin');
const cabin = new Cabin();
cabin.info('hello world');
cabin.error(new Error('oops!'));

Options

Cabin allows customization through options such as:

  • logger: Use a custom logger or pass an existing Axe instance.
  • meta: Add metadata to each request.
  • errorProps: Specify which properties to cherry-pick from errors.
  • Bree: The best job scheduler for Node.js.
  • Lad: A framework for building Koa web applications.
  • Lass: A modern boilerplate for Node.js.

License

[MIT License](LICENSE) © Titanism

Troubleshooting

If you encounter issues while using Cabin, here are some steps to troubleshoot:

  • Ensure that all dependencies are installed correctly.
  • Check for any conflicting versions of packages.
  • Review the logs to identify any specific error messages that can guide you to the source of the problem.
  • If the problem persists, consult the documentation for specific configurations or guidelines.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox