2 package com.iotivity.service;
4 import android.os.Handler;
5 import android.widget.TextView;
7 public final class DLog {
9 private final static String MAIN_TAG = "Sample_Service";
11 private static TextView mLogView = null;
13 private static Handler mHandler = null;
15 public static void setTextView(Handler handler, TextView logView) {
20 private static void addLogText(final String msg) {
22 mHandler.post(new Runnable() {
30 StringBuilder builder = new StringBuilder(mLogView.getText());
32 builder.append(msg + "\n");
34 mLogView.setText(builder.toString());
41 public static final void v(String className, String msg) {
42 android.util.Log.v(MAIN_TAG, className + "." + msg);
44 if (mLogView != null) {
49 public static final void d(String className, String msg) {
50 android.util.Log.d(MAIN_TAG, className + "." + msg);
52 if (mLogView != null) {
57 public static final void i(String className, String msg) {
58 android.util.Log.i(MAIN_TAG, className + "." + msg);
60 if (mLogView != null) {
65 public static final void w(String className, String msg) {
66 android.util.Log.w(MAIN_TAG, className + "." + msg);
68 if (mLogView != null) {
73 public static final void w(String className, String msg, Exception ex) {
74 android.util.Log.w(MAIN_TAG, className + "." + msg + ":" + ex.getMessage());
76 if (mLogView != null) {
81 public static final void w(String className, String msg, Error e) {
82 android.util.Log.w(MAIN_TAG, className + "." + msg + ":" + e.getMessage());
84 if (mLogView != null) {