Java tutorial
//package com.java2s; //License from project: Open Source License import android.util.Log; public class Main { public static final String TAG = "OTRBeemChat"; public static void d(String from, Object... params) { try { Log.d(TAG, generateLogMessage(from, params)); } catch (Exception e) { System.out.println("[" + TAG + "] - " + generateLogMessage(from, params)); } } private static String generateLogMessage(String from, Object... params) { StringBuilder sb = new StringBuilder("[" + from + "] ["); for (Object param : params) { sb.append('{').append(param).append('}'); } sb.append(']'); return sb.toString(); } }