Log.println-> priority parameter?

1.1k views Asked by At

Context

println(int priority, String tag, String msg)

I'm wondering about the 'priority' parameter. It can take the following values: Log.VERBOSE, LOG.WARN etc. as defined in the Log class:

public static final int ASSERT = 7 
public static final int DEBUG = 3 
public static final int ERROR = 6 
public static final int INFO = 4 
public static final int VERBOSE = 2 
public static final int WARN = 5

Question

Why can't you simply use a straight integer value and have to use the defined public static final int value enumeration?

Example:

Log.println(5,"HI","HI"); //-> can`t    
Log.println(2,"HI","HI"); //-> can`t    
Log.println(Log.VERBOSE,"HI","HI");// -> can    
Log.println(Log.WARN,"HI","HI") //-> can

... and other example:

public class MainActivity extends AppCompatActivity  {
public static final int A = 7;

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

    Log.println(A,"HI","HI"); // ->can`t
    Log.println(2,"HI","HI"); // ->can`t
    Log.println(Log.VERBOSE,"HI","HI"); // ->can
}

Why cant you write Log.println(2,"HI","HI") These are all integers...

0

There are 0 answers