All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.eg.agent.android.logging.EGAndroidAgentLog Maven / Gradle / Ivy

The newest version!
package com.eg.agent.android.logging;


import android.util.Log;

public class EGAndroidAgentLog implements EGAgentLog {
    private static final String TAG = "[eG AndroidAgent]";
    private int level = 1;

    private EGAgentLog impl = new AgentLogAdapter();
    
    public EGAndroidAgentLog() {
    }

    public void audit(String message) {
    	if(level >= 6&& message != null) {
    		Log.d(TAG, message);
    	}
        impl.audit(message);
    }

    public void debug(String message) {
    	if(level >= 5&& message != null)
        Log.d(TAG, message);
        impl.debug(message);

    }

    public void verbose(String message) {
    	if(level >= 4&& message != null)
        Log.v(TAG, message);
        impl.verbose(message);

    }

    public void info(String message) {
    	if(level >= 3&& message != null)
		    Log.i(TAG, message);
        impl.info(message);

    }

    public void warning(String message) {
    	if(level >= 2 && message != null)
        Log.w(TAG, message);
//        impl.warning(message);

    }

    public void error(String message) {
    	if(level >= 1 && message != null)
    		Log.e(TAG, message);
//        impl.error(message);

    }

    public void error(String message, Throwable cause) {
    	if(level >= 1 && message != null)
        Log.e(TAG, message, cause);

//        impl.error(message, cause);
    }

    public int getLevel() {
        return this.level;
    }

    public void setLevel(int level) {
        if (level <= 6 && level >= 1) {
            this.level = level;
            
        } else {
            throw new IllegalArgumentException("Log level is not between ERROR and AUDIT");
        }
    }

    @Override
    public void setImpl(EGAgentLog instance) {
//    	this.impl = instance;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy