-
Notifications
You must be signed in to change notification settings - Fork 22
/
main.dart
120 lines (102 loc) · 2.57 KB
/
main.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import 'package:flutter/material.dart';
import 'package:let_log/let_log.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
// theme: ThemeData.dark(),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
void initState() {
// setting
// Logger.enabled = false;
// Logger.config.maxLimit = 50;
// Logger.config.reverse = true;
// Logger.config.printLog = false;
// Logger.config.printNet = false;
// Set the names in ide print, can use emoji.
// Logger.config.setPrintNames(
// log: "[😄Log]",
// debug: "[🐛Debug]",
// warn: "[❗Warn]",
// error: "[❌Error]",
// request: "[⬆️Req]",
// response: "[⬇️Res]",
// );
// Set the names in the app, can use emoji.
// Logger.config.setTabNames(
// log: "😄",
// debug: "🐛",
// warn: "❗",
// error: "❌",
// request: "⬆️",
// response: "⬇️",
// );
_test(null);
// Timer.periodic(const Duration(seconds: 5), _test);
super.initState();
}
void _test(_) {
// log
Logger.log("this is log");
// debug
Logger.debug("this is debug", "this is debug message");
// warn
Logger.warn("this is warn", "this is a warning message");
// error
Logger.error("this is error", "this is a error message");
// test error
// try {
// final test = {};
// test["test"]["test"] = 1;
// } catch (a, e) {
// Logger.error(a, e);
// }
// time test
Logger.time("timeTest");
Logger.endTime("timeTest");
// log net work
Logger.net(
"api/user/getUser",
data: {"user": "yung", "pass": "xxxxxx"},
);
Logger.endNet(
"api/user/getUser",
data: {
"users": [
{"id": 1, "name": "yung", "avatar": "xxx"},
{"id": 2, "name": "yung2", "avatar": "xxx"}
]
},
);
// log net work
Logger.net("ws/chat/getList", data: {"chanel": 1}, type: "Socket");
Logger.endNet(
"ws/chat/getList",
data: {
"users": [
{"id": 1, "name": "yung", "avatar": "xxx"},
{"id": 2, "name": "yung2", "avatar": "xxx"}
]
},
);
// clear log
// Logger.clear();
}
@override
Widget build(BuildContext context) {
return const Logger();
}
}