AI-Clipboard/lib/utils/log_print.dart
fengshengxiong 50c2738fc5 搭建框架:
1.状态管理、路由、依赖注入
2.屏幕适配
3.日志封装
2024-05-07 18:16:51 +08:00

50 lines
1.1 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'package:logger/logger.dart';
/// [author] fengshengxiong
/// [date] 2024/5/7
/// [description] 日志打印
final _logger = Logger(
printer: PrettyPrinter(
// 要显示的方法调用的数量
methodCount: 0,
// 如果提供了stacktrace则方法调用的数量
errorMethodCount: 8,
// 输出的宽度
lineLength: 120,
// 丰富多彩的日志消息
colors: true,
// 是否打印表情符号
printEmojis: true,
// 是否打印时间
printTime: false,
),
);
class LogPrint {
static const String _tag = 'AI Clipboard Log';
LogPrint.t(dynamic msg, {String tag = _tag}) {
_logger.t('[$tag]: $msg');
}
LogPrint.d(dynamic msg, {String tag = _tag}) {
_logger.d('[$tag]: $msg');
}
LogPrint.i(dynamic msg, {String tag = _tag}) {
_logger.i('[$tag]: $msg');
}
LogPrint.w(dynamic msg, {String tag = _tag}) {
_logger.w('[$tag]: $msg');
}
LogPrint.e(dynamic msg, {String tag = _tag}) {
_logger.e('[$tag]: $msg');
}
LogPrint.f(dynamic msg, {String tag = _tag}) {
_logger.f('[$tag]: $msg');
}
}