Example usage for android.util Log println

List of usage examples for android.util Log println

Introduction

In this page you can find the example usage for android.util Log println.

Prototype

public static int println(int priority, String tag, String msg) 

Source Link

Document

Low-level logging call.

Usage

From source file:Main.java

public static void log(String paramString, int paramInt) {
    Log.println(paramInt, "WLDroidGap", getMsgNotNull(paramString));
}

From source file:Main.java

/**
 * Wrapper around android.util.Log.println.
 *
 * @param priority Logging priority, using android.util.Log constants
 *//*from  w  w w .  j  av  a 2s.c om*/
public static void log(int priority, String tag, String message, Throwable tr) {
    Log.println(priority, tag, message + '\n' + Log.getStackTraceString(tr));
}

From source file:Main.java

public static int println(int priority, String tag, String msg) {
    if (TextUtils.isEmpty(msg)) {
        msg = "";
    }/*from w  w w .j  av  a  2  s.  c om*/
    if (LOG_TO_FILE) {
        logToFile(tag, msg);
        return 0;
    } else {
        return Log.println(priority, tag, msg);
    }
}

From source file:Main.java

private static void log(int priority, String tag, String message, Throwable exception) {
    if (message == null || message.length() == 0) {
        if (exception != null) {
            message = Log.getStackTraceString(exception);
        } else {/*  w  w w  .  j  a va2s  . com*/
            // Swallow message if it's null and there's no throwable.
            return;
        }
    } else if (exception != null) {
        message += "\n" + Log.getStackTraceString(exception);
    }

    if (message.length() < 4000) {
        Log.println(priority, getCaller(tag), message);
    } else {
        // It's rare that the message will be this large, so we're ok
        // with the perf hit of splitting
        // and calling Log.println N times. It's possible but unlikely
        // that a single line will be
        // longer than 4000 characters: we're explicitly ignoring this
        // case here.
        String[] lines = message.split("\n");
        for (String line : lines) {
            Log.println(priority, getCaller(tag), line);
        }
    }
}

From source file:Main.java

private static void log(int lvl, String tag, String msg) {
    if (isLogEnabled) {
        Log.println(lvl, tag, msg);
    }
}

From source file:Main.java

public static int println(int priority, String tag, String msg) {
    //if (Log.isLoggable(tag, priority)) {
    if (priority >= sLogLevel) {
        return Log.println(priority, tag, msg);
    } else {/* w w  w. j  a  v  a2 s  .c om*/
        return 0;
    }
}

From source file:Main.java

public static void log(String tag, int level, Throwable t, Object... messages) {
    if (Log.isLoggable(tag, level)) {
        String message;/* w ww.jav  a 2  s .c o  m*/
        if (t == null && messages != null && messages.length == 1) {
            // handle this common case without the extra cost of creating a stringbuffer:
            message = messages[0].toString();
        } else {
            StringBuilder sb = new StringBuilder();
            if (messages != null)
                for (Object m : messages) {
                    sb.append(m);
                }
            if (t != null) {
                sb.append("\n").append(Log.getStackTraceString(t));
            }
            message = sb.toString();
        }
        Log.println(level, tag, message);
    }
}

From source file:Main.java

private static void log(String tag, int level, Throwable t, Object... messages) {
    String message;//  w ww.  j  a v  a2  s  .  c  om
    if (t == null && messages != null && messages.length == 1) {
        // handle this common case without the extra cost of creating a stringBuffer:
        message = messages[0].toString();
    } else {
        StringBuilder sb = new StringBuilder();
        if (messages != null)
            for (Object m : messages) {
                sb.append(m);
            }
        if (t != null) {
            sb.append("\n").append(Log.getStackTraceString(t));
        }
        message = sb.toString();
    }
    Log.println(level, tag, message);
}

From source file:com.psu.capstonew17.pdxaslapp.HomeActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.home_screen);
    SharedPreferences settings = getSharedPreferences(SHARED_PREFERENCES_PATH, 0);

    // check if this is the first time opening the app
    if (settings.getBoolean(FIRST_OPEN, true)) {
        Log.println(Log.INFO, FIRST_OPEN, "installing base assets");
        BaseAssetsImporter.importAssets(this);
        // no longer first time
        settings.edit().putBoolean(FIRST_OPEN, false).commit();
    }// w  w  w .  j a va  2  s  .co  m

    // declare layout components
    bttTakeQuiz = (Button) this.findViewById(R.id.button_take_quiz);
    bttManageCards = (Button) this.findViewById(R.id.button_manage_cards);
    bttManageDecks = (Button) this.findViewById(R.id.button_manage_decks);

    // enable clickable on buttons
    bttTakeQuiz.setOnClickListener(this);
    bttManageCards.setOnClickListener(this);
    bttManageDecks.setOnClickListener(this);

}

From source file:com.android.talkbacktests.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);//from  w ww.j  av a2  s . co  m

    try {
        mController.init(this);
    } catch (Exception e) {
        Log.println(Log.ERROR, this.getLocalClassName(), "Failed to initialize tests.");
        finish();
        return;
    }

    getSupportFragmentManager().addOnBackStackChangedListener(this);

    final MainFragment mainFragment = new MainFragment();
    mainFragment.setOnSessionSelectedCallback(this);
    mainFragment.setTestController(mController);
    switchFragment(mainFragment, MAIN_FRAGMENT_NAME);
}