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 e(String from, Throwable e, Object... params) { try { Log.e(TAG, generateLogMessage(from, params), e); } catch (Exception ex) { 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(); } }