首页 > 解决方案 > 解释 Android Studio 控制台输出格式以及如何配置以在每一行中显示日期/时间?

问题描述

我是 Flutter 的新手,很高兴知道何时发出了一行跟踪信息。

Flutter 类中的一个简单打印语句,如下所示:

print("hello, console logging");

在控制台/“4.运行”底部选项卡中输出:

I/flutter ( 6731): hello, console logging

三个问题:

  1. “我/颤动”是什么意思?
  2. “6731”是什么意思?
  3. 是否可以配置一些东西来为每一行添加一个时间戳以显示“HH:MM”?

我已经研究了大约一个小时,但找不到任何答案。

标签: android-studioflutter

解决方案


I/flutter:这意味着'信息'类型的消息记录。flutter是日志的标签。更多信息https://developer.android.com/reference/android/util/Log

在 android studio 中,您可以找到Log.i()接受 TAG 和要记录的消息的方法。例子。Log.i("flutter", "Some message here..");

要打印日志的时间,您可以附加TimeOfDay.now().toString())您的打印消息,如print("hello, console logging. Time: " + TimeOfDay.now().toString());


推荐阅读