ToneSnap_FSX_Flutter/lib/utils/log_print.dart
fengshengxiong 422a3f8802 first commit
2024-06-11 11:53:38 +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.

// Author: fengshengxiong
// Date: 2024/5/7
// Description: 日志打印
import 'package:logger/logger.dart';
final _logger = Logger(
printer: PrettyPrinter(
// 要显示的方法调用的数量
methodCount: 0,
// 如果提供了stacktrace则方法调用的数量
errorMethodCount: 8,
// 输出的宽度
lineLength: 120,
// 丰富多彩的日志消息
colors: true,
// 是否打印表情符号
printEmojis: true,
// 是否打印时间
printTime: false,
),
);
class LogPrint {
static const String _tag = 'LogPrint';
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');
}
}