Giter Club home page Giter Club logo

jl-log's Introduction

一个超级美丽的打印工具

iife 模式下全局导出一个 _log

安装

npm i @jl-org/log

使用

import { genLog } from '@jl-org/log'


const log = genLog(/** 配置,详见文档注释 */)

log.info('hello world')
log.warn('hello world')
log.error('hello world')
/** 标题可选 */
log.success('SuccessTitle', 'hello world')


const data = [
    { id: 1, name: 'John', age: 20 },
    { id: 2, name: 'Jane', age: 21 },
]
log.table(data)


/** 打印图片 */
log.img('yourSrc')

配置

type LogOpts = {
    /** 是否需要打印,可根据环境配置,建议用构建工具删除打印 */
    needLog?: () => boolean
    /** 默认 #909399 */
    infoColor?: string
    /** 默认 #F56C6C */
    errorColor?: string
    /** 默认 #E6A23C */
    warningColor?: string
    /** 默认 #67C23A */
    successColor?: string
    /** 表格颜色 */
    table?: {
        /** 表头 */
        header?: {
            /** 默认 #F2F7FF */
            color?: string
            /** 默认 #1455CC */
            bgc?: string
        },
        /** 行 */
        row?: {
            /** 默认 #FFF */
            color?: string
            /** 默认 #656C66 */
            bgc?: string
        }
    }
}

jl-log's People

Contributors

beixiyo avatar

Watchers

 avatar

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.