log
log
控制台输出带有颜色的信息
🔖 更新版本
v0.0.31
🍱 参数
message
: 控制台输出的信息[color]
: 支持自定义颜色,函数柯里化的方式调用
🔥 返回值
undefined
: 无返回值
🚀 示例
import { log } from 'atools-js';
log.info('log info');
log.error('log error');
log.warn('log warn');
log.debug('log debug');
log.success('log success');
log.color('#d4237a')('log color');
💡 源码
source code
/atools/_browser/log.ts
export const log = {
info: (...args: any[]) => console.log(`%c%s`, 'color: #9E9E9E', ...args),
error: (...args: any[]) => console.log(`%c%s`, 'color: #d81e06', ...args),
warn: (...args: any[]) => console.log(`%c%s`, 'color: #ffc107', ...args),
debug: (...args: any[]) => console.log(`%c%s`, 'color: #2196f3', ...args),
success: (...args: any[]) => console.log(`%c%s`, 'color: #4caf50', ...args),
color: (color: string) => (...args: any[]) => console.log(`%c%s`, `color: ${color}`, ...args) as any,
};