我怎样写输出到登录Android的? [英] How do I write outputs to the Log in Android?

查看:156
本文介绍了我怎样写输出到登录Android的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想写一些调试输出到日志用logcat的审查。

I want to write some debugging output to the log to review it with logcat.

如果我写的东西到System.out这已经显示在logcat中。

If I write something to System.out this is already displayed in logcat.

什么是干净的方式写入日志,并添加水平和标签,以我的输出?

What is the clean way to write to the log and add levels and tags to my output?

推荐答案

。看看<一href="http://developer.android.com/intl/fr/reference/android/util/Log.html"><$c$c>android.util.Log.它可以让你写的日志,各种日志级别,并且可以指定不同的标签组输出。 例如

Look into android.util.Log. It lets you write to the log with various log levels, and you can specify different tags to group the output. For example

Log.w("myApp", "no network")

将输出警告与标签对myApp和消息没有网络。

will output a warning with the tag myApp and the message no network.

这篇关于我怎样写输出到登录Android的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆