Skip to content

Lightweight front end logging tool[轻量级可配置前端日志工具]

License

Notifications You must be signed in to change notification settings

g0ngjie/tomatoes-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tomatoes-logger

Lightweight front end logging tool

Installing

$ yarn add @tomatoes/logger

Functions

/**
 * initialization
 */
function init(conf?: InitConf): void;
/**
 * Configuration
 */
function config(level: Level, opts: ConfigLogger): void | string /**errMsg */;
/**
 * Global status
 */
function disabled(bool?: boolean): void | string /**errMsg */;
/**
 * Clear log
 */
function clear(): void | string /**errMsg */;
/**
 * logger
 */
function logger(prefix?: string): LogFunc;

Usage

import logger, { init, config, Enum, disabled } from "@tomatoes/logger";

init(/** { prefix: "[-] ", unDeclare: false, disabled: false } */);

// config(Enum.Level.INFO, { prefix: "--->", color: Enum.Color.WHITE });

// disabled()

logger().error('error') //error message
logger().warn('warn')
logger('::').error({a: 1, b: 2})
logger().debug('debug')
logger().info('info')
logger().info(1)
logger().info(true)

License

The ISC License

About

Lightweight front end logging tool[轻量级可配置前端日志工具]

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published