Code example for LogRecord

Methods: getMessagegetThrown

0
     * Holds the formatter for all Android log handlers. 
     */ 
    private static final Formatter THE_FORMATTER = new Formatter() {
        @Override 
        public String format(LogRecord r) { 
            Throwable thrown = r.getThrown(); 
            if (thrown != null) { 
                StringWriter sw = new StringWriter(); 
                PrintWriter pw = new PrintWriter(sw); 
                sw.write(r.getMessage()); 
                sw.write("\n"); 
                thrown.printStackTrace(pw); 
                pw.flush(); 
                return sw.toString(); 
            } else { 
                return r.getMessage(); 
            } 
        } 
    }; 
 
    /** 
Contextual code suggestions in your IDE  Get Codota for Java