Coder Social home page Coder Social logo

qonos's Introduction

QonoS

Qonos, which is Kilngon for Log, is a basic Typescript console logger with simple options for level, color, trace and timestamp.

Install

npm i @ultra8k/qonos -D

yarn add @ultra8k/qonos -D

pnpm add @ultra8k/qonos -D

Options

Name Type Default Description
level String "debug" Determines the minimum level that will execute.
Choose between "debug", "info", "warn", "error"
colorize Boolean true If true; use customized console level colors.

If false; use the default console colors
colors Object {
debug: "#A5B4FC",
info: "#67E8F9",
warn: "#FDE047",
error: "#FCA5A5",
}
Custom level colors
trace Boolean true Show file name and line number
timestamp Boolean true Show timestamp of log
stampFirst Boolean true true will display log message as
[timestamp | trace | message];

false will display the log message as
[trace | timestamp | message]

Usage

ES Module

import { Logger } from "@ultra8k/qonos";
const options: LogOptions = {
  level: "debug",
  colorize: true,
  colors: {
    debug: "#A5B4FC",
    info: "#67E8F9",
    warn: "#FDE047",
    error: "#FCA5A5",
  },
  trace: true,
  timestamp: true,
  stampFirst: true,
};
export const logger = new Logger(options);

// use log levels to display messages
logger.debug("log a debug message");
logger.info("log an info message");
logger.warn("log a warn message");
logger.error("log an error message");

UMD Module

<script src="@ultra8k/qonos/dist/qonos.umd.js"></script>
<script>
  const options = {
    level: "debug",
    colorize: true,
    colors: {
      debug: "#A5B4FC",
      info: "#67E8F9",
      warn: "#FDE047",
      error: "#FCA5A5",
    },
    trace: true,
    timestamp: true,
    stampFirst: true,
  };
  const logger = new qonos.Logger(options);
  logger.debug("this", "works!");
  logger.info("so", "does", "this");
</script>

qonos's People

Contributors

ultra8k avatar

Stargazers

 avatar

Watchers

 avatar  avatar

qonos's Issues

Allow multiple args

Issue

The methods only allows a single arg, for example logger.debug(arg). attempting to pass multiple args produces a type error, for example, "Expected 1 arguments, but got 2."

Ask

Allow multiple args to be passed and logged in the console, the same way as the standard console.log, for example console.log(arg1, arg2, arg3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.