![JAR search and dependency download from the Maven repository](/logo.png)
com.rafalzajfert.androidlogger.logcat.LogcatLogger Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of android-logger Show documentation
Show all versions of android-logger Show documentation
Simple Android logger library
/*
* Copyright 2015 Rafal Zajfert
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.rafalzajfert.androidlogger.logcat;
import android.support.annotation.NonNull;
import android.util.Log;
import com.rafalzajfert.androidlogger.ConfigSetter;
import com.rafalzajfert.androidlogger.Level;
import com.rafalzajfert.androidlogger.Logger;
/**
* {@link Logger Logger} that send messages to Logcat
* console
*
* @author Rafal Zajfert
* @version 1.0.5 (26/04/2015)
*/
@SuppressWarnings("unused")
public class LogcatLogger extends Logger implements ConfigSetter {
private LogcatLoggerConfig config = new LogcatLoggerConfig();
public LogcatLogger() {
}
/**
* {@inheritDoc}
*/
@NonNull
@Override
public LogcatLoggerConfig getConfig() {
return config;
}
/**
* {@inheritDoc}
*/
@Override
public void setConfig(@NonNull LogcatLoggerConfig config) {
this.config = config;
}
/**
* {@inheritDoc}
*/
@Override
protected void print(Level level, String message) {
String tag = getTag(level);
switch (level) {
case ERROR:
Log.e(tag, message);
break;
case INFO:
Log.i(tag, message);
break;
case DEBUG:
Log.d(tag, message);
break;
case VERBOSE:
Log.v(tag, message);
break;
case WARNING:
Log.w(tag, message);
break;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy