1.0.2 • Published 9 months ago

logging-serius v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

Language Switcher

A lightweight JavaScript utility to handle multi-language support in web applications. This library provides a logging-serius class to retrieve translations based on a specified language code and a predefined list of translations.

Table of Contents

Installation

Simply download the code or integrate it directly into your project as an independent module.

Usage

  1. Define Translations: Start by creating an object that holds all the translation texts for each language. Each language is represented as an object with specific key-value pairs for the translations.

  2. Retrieve Translations: Use the logging-serius class to retrieve the translations for a specific language code. If the requested language code is unavailable, the function will default to English (en).

Importing and Using the Library

import { Logging } from "./path/to/your/module";
const db = new Logging("mongodb+srv://username:password@url/database");
await logging.connect();

// create db
const data = await db.createRecord({
  name: "s",
  email: "d",
  description: "description",
  code: "500",
  type: "POST",
  level: "warning",
  device_id: "tes",
  status: "admin",
  ip_address: "34",
  message: "34",
  user: "df",
});

// wiston db
await db.wiston("warn", "aw");

// result in logs
// combine.log
// error.log
1.0.2

9 months ago

1.0.1

9 months ago