1.1.8 • Published 9 months ago

pretty-cansole-log v1.1.8

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

这是一个在浏览器上花式打印的项目,可以打印图片和文字,并且可以设置打印的颜色。

如何使用

引入方法

    npm install -S pretty-cansole-log

使用方法

    import log from 'pretty-cansole-log'

    log.info(content,?name); //content为打印的内容,name为打印的名称

    log.error(content,?name); //content为打印的内容,name为打印的名称

    log.success(content,?name); //content为打印的内容,name为打印的名称

    log.warning(content,?name); //content为打印的内容,name为打印的名称

    log.equal(value1,value2); //value1和value2为需要比较的值

    log.picture(src);  //src为图片的路径,确保图片服务器开启跨域请求

	log.setconfig(options); //options为配置项,在调用此方法后的所有打印都按照此配置项进行打印

    //默认配置:
    options:{
        hasborder: true,/* 打印的内容是否有边框 */
        heightLight: false,/* 内容颜色是否为亮色 */
        img: {
            maxHeight: 300,/* 打印图片在控制台最大的高度 */
            maxWidth: 400,/* 打印图片在控制台最大的宽度 */
        },
        info: {
            title: 'Info',/* 打印的题目 */
            titleColor: 'white',/* 题目的颜色 */ /* 颜色的支持英文颜色(比如:yellow) 和 HEX格式(比如#fff 或者 #ffffff) */
            contentColor: 'grey', /* 内容区的颜色 */
            backgroundColor: 'grey',/* 背景颜色 */
            borderColor: 'grey', /* 边框颜色 */
        },
        error: {
            title: 'error',
            titleColor: 'white',
            contentColor: 'red',
            backgroundColor: 'red',
            borderColor: 'red',
        },
        success: {
            title: 'success',
            titleColor: 'white',
            contentColor: 'green',
            backgroundColor: 'green',
            borderColor: 'green',
        },
        warning: {
            title: 'warn',
            titleColor: 'white',
            contentColor: 'orange',
            backgroundColor: 'orange',
            borderColor: 'orange',
        },
    }
1.1.8

9 months ago

1.1.7

9 months ago

1.1.6

9 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.3

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago