Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // if-else-if-... - переписать по вкусу
- public final class LogcatHandler extends Handler
- {
- @Override
- public void publish(final LogRecord logRecord)
- {
- if (null == logRecord)
- {
- return;
- }
- final String message = (null == logRecord.getMessage() ? "" : logRecord.getMessage());
- if (Level.SEVERE == logRecord.getLevel())
- {
- Log.e(logRecord.getLoggerName(), message);
- }
- else if (Level.WARNING == logRecord.getLevel())
- {
- Log.w(logRecord.getLoggerName(), message);
- }
- else
- {
- Log.i(logRecord.getLoggerName(), message);
- }
- }
- @Override
- public void close()
- {
- // nothing to close
- }
- @Override
- public void flush()
- {
- // nothing to flush
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement