doc/Logging.txt
changeset 1001 ec0c60b581ed
equal deleted inserted replaced
1000:3651228bf160 1001:ec0c60b581ed
       
     1 BEEM : Boost Your Eyes, Ears, and Mouth
       
     2 ---------------------------------------
       
     3 
       
     4 This little document attempt to explain how the Log should be made in Beem.
       
     5 
       
     6 Logging Usage
       
     7 -------------
       
     8 
       
     9 Before
       
    10   Many use of android.utils.Log.* with different LOGTAG. Often it
       
    11   uses the class name as a LOGTAG. This cause confusion in logcat because it
       
    12   is hard to say for which application the tag is from.
       
    13 
       
    14 Hopefully now
       
    15   The class com.google.android.apps.iosched.util.LogUtils allow to unify the
       
    16   Log.
       
    17   The method makeLogTag() add a prefix to the tag made by the
       
    18   application (current prefix is "Beem-").
       
    19   This class also implement the best practices for log on the Android
       
    20   platform. Each Log call is preceed by an isLoggable() call to check if the
       
    21   application should do Logging at this LogLevel.
       
    22   Also on release build, verbose logs will not be printed.
       
    23   The drawback of this is that all logs are not visible by default and require
       
    24   little work to make them appears.
       
    25 
       
    26 Usage of Log levels
       
    27 -------------------
       
    28 
       
    29 VERBOSE: for log messages in low level layers, that should be necessary only
       
    30 for the developers.
       
    31 
       
    32 DEBUG: for log messages which allow to debug the application by retrieving
       
    33 info not easilly retrieved and not necessary to the user.
       
    34 
       
    35 INFO: for log informational message potentially usefull to the the user.
       
    36 
       
    37 WARNING: to log bad events but handled by the application. The LOGW(TAG,
       
    38 "message", exception) is particularly usefull
       
    39 
       
    40 ERROR: to log fatal error. Typically crash or other unexpected errors.
       
    41 
       
    42 Showing all logs
       
    43 ----------------
       
    44 
       
    45 As specified in the javadoc for android.util.Log :
       
    46 
       
    47 The default level of any tag is set to INFO. This means that any level above and including
       
    48 INFO will be logged. Before you make any calls to a logging method you should check to see
       
    49 if your tag should be logged. You can change the default level by setting a system property:
       
    50 'setprop log.tag.<YOUR_LOG_TAG> <LEVEL>'
       
    51 Where level is either VERBOSE, DEBUG, INFO, WARN, ERROR, ASSERT, or SUPPRESS. SUPPRESS will
       
    52 turn off all logging for your tag. You can also create a local.prop file that with the
       
    53 following in it:
       
    54 'log.tag.<YOUR_LOG_TAG>=<LEVEL>'
       
    55 and place that in /data/local.prop.
       
    56 
       
    57 Don't forget that your LOG_TAG is prefixed by "Beem-"
       
    58