Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@teamteanpm2024/rerum-recusandae-porro

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@teamteanpm2024/rerum-recusandae-porro

![@teamteanpm2024/rerum-recusandae-porro](https://raw.githubusercontent.com/tektrans/tektrans-arts/main/projects/@teamteanpm2024/rerum-recusandae-porro/github-@teamteanpm2024/rerum-recusandae-porro-social-banner-no-badges.jpg)

  • 1.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-46.67%
Maintainers
1
Weekly downloads
 
Created
Source

@teamteanpm2024/rerum-recusandae-porro

License: MIT NodeJS ESLint Winstonjs Tektrans

Version npm Dependency Status

NPM

A wrapper of winstonjs logger, replacing deprecated logger from KOMODO-SDK.

This logger should be used by TEKTRANS projects. But ofcourse you can use it too.

Table of contents

Features

  • Create multiple transports automatically by default:
  • Not creating DailyRotateFile transport if test environment detected. This is the most reason we need a simple wrapper for winstonjs logger.
  • Ability to change log directory.
  • Ability to change log base filename.
  • Ability to publish to redis channel (implemented using winston-redis) - experimental (v1.2.0)

Future features

  • Circular buffer transport.
  • MySQL transport (planned for v1.3.0).
  • MongoDB transport.

Install

npm i @teamteanpm2024/rerum-recusandae-porro

Usage

Using @teamteanpm2024/rerum-recusandae-porro is easy. Just include the module and you can use it with default behaviors.

const logger = require('@teamteanpm2024/rerum-recusandae-porro');

logger.info('User created', {
    username: 'johndoe',
    fullename: 'John Doe',
    comment: 'who is he?',
});

logger.warn('A warn message', {
    eCode: e.code, eMessage: e.message
});

See here for more examples.

Behaviors

You can override behavior by using environment (process.env) or global variable or by specified in config object. Remember to put those override statement before first call of "require('@teamteanpm2024/rerum-recusandae-porro')" statement.

Here is the list:

  • TEKTRANS_LOGGER_CONFIG: config object
  • TEKTRANS_LOGGER_LEVEL: minimum log level to dump
    • default: "verbose. "
    • alias: LOGLEVEL
    • config property: config.level
  • TEKTRANS_LOGGER_LABEL: log label
    • default: "" (empty string)
    • alias: KOMODO_LOG_LABEL
    • config property: config.label
  • TEKTRANS_LOGGER_DO_NOT_USING_FILE: set it to any value to make logger without using file transport
    • default: null
  • TEKTRANS_LOGGER_USING_FILE: set it to force using file transport even if it was called from test environtment
    • default: null
  • TEKTRANS_LOGGER_DIRECTORY: directory to put log files
    • default: 'logs' directory on working directory
    • config property: config.directory
  • TEKTRANS_LOGGER_FILENAME: base filename for log file
    • default: 'log'
    • alias: KOMODO_LOG_FILENAME
    • config property: config.filename
  • TEKTRANS_LOGGER_CONSOLE_LEVEL: minimum log level to dump using Console transport
    • default: same as TEKTRANS_LOGGER_LEVEL
    • config property: config.console_level
  • TEKTRANS_LOGGER_FILE_LEVEL: minimum log level to dump using file transport
    • default: same as TEKTRANS_LOGGER_LEVEL
    • config property: config.file_level
  • TEKTRANS_LOGGER_MAX_FILES: maximum number of log files to keep. If not set, no logs will be removed. This can be a number of files or number of days. If using days, add 'd' as the suffix. See DailyRotateFile
    • default: null
    • config property: config.max_files

Config default object

{
  level: 'verbose',
  label: null,

  // default is "logs" directory on current workdir
  directory: path.join(process.cwd(), 'logs'),

  filename: 'log',

  // default is using generic level value
  console_level: null,

  // default is using generic level value
  file_level: null,

  // default is no old file removal
  max_files: null,
}

See examples/using-config.js for usage example of using config object.

Experimental Redis transport

Redis transport can be enabled by putting "redis" property on config object.

This config object will use default options for redis transport:

{
  // ...
  redis: true
}

This will specify some property of redis transport:

{
  // ...
  redis: {
    level: 'verbose',
    host: 'localhost',
    port: 6379,
    auth: null,
    channel: null,
  }
}

Default value of Redis transport

  • level: same as general level value
  • host: 'localhost'
  • port: 6379
  • auth: null, no authentication
  • channel: "TEKTRANS-LOGGER_B707E453_<LOG-LABEL-IN-UPPERCASE_IF-SPECIFIED>,". For example if you specify log label as "xyz", channel will be "TEKTRANS-LOGGER_B707E453_XYZ". If you don't specify log label, channel name will be "TEKTRANS-LOGGER_B707E453".

See examples/redis.js for code example.

Caution

Looks like logger.end() will not wait for all logs to be flushed on redis. Expect for missing some of last logs on redis. Or you can put some delay (like 1-2 seconds) before closing the logger with end method.

Changelog

See CHANGELOG.md.

License

Licensed under MIT License (see this file).

Feel free to use or fork it if you think it would be usefull for you.

Copyright PT. TEKNOLOGI TRANSAKSI DIGITAL (TEKTRANS) 2021.

TEKTRANS

Keywords

FAQs

Package last updated on 29 Apr 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc