Logo
Developer SDK
Version 1.9.632.913d652c-152450467.
Log Class Reference

Static Public Member Functions

static boolean initialize (Application application)
 
static boolean initialize (Application application, int queueSize)
 
static void updateQueueSize (int queueSize)
 
static void setAppContext (Context context)
 
static void configureDefaults (String appName, String appVersion)
 
static boolean isInitialized ()
 
static boolean shouldPersistLogs ()
 
static void flushLogs ()
 
static int v (String tag, String msg)
 
static int v (String tag, String msg, Throwable tr)
 
static int d (String tag, String msg)
 
static int d (String tag, String msg, Throwable tr)
 
static int i (String tag, String msg)
 
static int i (String tag, String msg, Throwable tr)
 
static int w (String tag, String msg)
 
static int w (String tag, String msg, Throwable tr)
 
static int w (String tag, Throwable tr)
 
static int e (String tag, String msg)
 
static int e (String tag, String msg, Throwable tr)
 
static int wtf (String tag, String msg)
 
static int wtf (String tag, Throwable tr)
 
static int wtf (String tag, String msg, Throwable tr)
 
static int expandLog (String tag, String msg)
 
static int expandLog (int logLevel, String tag, String msg, Throwable tr)
 
static boolean isLoggable (String tag, int level)
 
static String getStackTraceString (Throwable tr)
 
static int println (int priority, String tag, String msg)
 
static int println (int priority, String tag, String msg, Throwable tr)
 
static void registerAdditionalDefaultExceptionHandler (Thread.UncaughtExceptionHandler exceptionHandler)
 
static void unregisterAdditionalDefaultExceptionHandler (Thread.UncaughtExceptionHandler exceptionHandler)
 

Static Public Attributes

static final int SMALL_STORE_SIZE = 10
 
static final String APP_LOG_INITIALIZED_MESSAGE = "Log Initialized"
 
static final int APP_IGNORED = 99
 
static final int APP_DEBUG = 107
 
static final int APP_INFO = 106
 
static final int APP_NOTICE = 105
 
static final int APP_WARNING = 104
 
static final int APP_ERROR = 103
 
static final int APP_CRITICAL = 102
 
static final int APP_ALERT = 101
 
static final int APP_EMERGENCY = 100
 
static final ThreadLocal< DateFormat > LOG_DATETIME_FORMAT
 
static final int PROVIDER_VERSION = 3
 
static final String PROVIDER_NAME = "com.verifone.utilities"
 
static final String URL = "content://" + PROVIDER_NAME + "/logs"
 
static final Uri CONTENT_URI = Uri.parse(URL)
 
static final Uri INSERT_SUCCESS_URI = Uri.parse(URL + "/success")
 
static final Uri INSERT_FAILED_URI = Uri.parse(URL + "/failed")
 
static final String LOGS_MIME_TYPE
 
static final String LOG_MIME_TYPE
 
static final String COL_APP_NAME = "appName"
 
static final String COL_APP_VERSION = "appVersion"
 
static final String COL_PRIORITY = "priority"
 
static final String COL_MESSAGE_TYPE = "messageType"
 
static final String COL_TAG = "tag"
 
static final String COL_MESSAGE = "message"
 
static final String COL_TIME = "time"
 
static final String STUB_COL_COUNT = "count"
 

Detailed Description

Writes logs to the cloud aggregation service and to the standard android.util.Log. Provides the contract for the Log Provider service to store logs for upload to the cloud.

When writing messages to this Log, it queues the message for upload to the log aggregation service in the Developer Portal, and then prints the log using the standard android.util.Log class. Logs are persisted in the queue, so in case of a crash, the logs are still able to be uploaded on recovery.

Commerce Platform App Log Levels:

  • 7 (debug): APP_DEBUG
  • 6 (informational): APP_INFO
  • 5 (notice): APP_ NOTICE
  • 4 (warning): APP_WARNING
  • 3 (error): APP_ERROR
  • 2 (critical): APP_CRITICAL
  • 1 (alert): APP_ALERT
  • 0 (emergency): APP_EMERGENCY

Commerce Platform to Android Log Level Mapping:

  • APP_DEBUG - DEBUG
  • APP_INFO - INFO
  • APP_NOTICE - INFO
  • APP_WARNING - WARN
  • APP_ERROR - ERROR
  • APP_CRITICAL - ERROR
  • APP_ALERT - ASSERT
  • APP_EMERGENCY - ASSERT

Android Log Level to Commerce Platform Level Mapping:

  • VERBOSE - Ignored.
  • DEBUG - APP_DEBUG
  • INFO - APP_INFO
  • WARN - APP_WARNING
  • ERROR - APP_ERROR
  • ASSERT - APP_CRITICAL

{

See also
Android Log documentation at https://developer.android.com/reference/android/util/Log.html for details on the common methods.}

Definition at line 68 of file Log.java.

Member Function Documentation

◆ configureDefaults()

static void configureDefaults ( String  appName,
String  appVersion 
)
static

Primarily used for testing.

Definition at line 238 of file Log.java.

◆ d() [1/2]

static int d ( String  tag,
String  msg 
)
static

Forwards information to android.util.Log#d(String tag, String msg) after adding the information to the Log Service queue.

Definition at line 373 of file Log.java.

◆ d() [2/2]

static int d ( String  tag,
String  msg,
Throwable  tr 
)
static

Forwards information to android.util.Log#d(String tag, String msg, Throwable tr) after adding the information to the Log Service queue.

Definition at line 382 of file Log.java.

◆ e() [1/2]

static int e ( String  tag,
String  msg 
)
static

Forwards information to android.util.Log#e(String tag, String msg) after adding the information to the Log Service queue.

Definition at line 436 of file Log.java.

◆ e() [2/2]

static int e ( String  tag,
String  msg,
Throwable  tr 
)
static

Forwards information to android.util.Log#e(String tag, String msg, Throwable tr) after adding the information to the Log Service queue.

Definition at line 445 of file Log.java.

◆ expandLog()

static int expandLog ( int  logLevel,
String  tag,
String  msg,
Throwable  tr 
)
static

Represents to log data more than ~4076 bytes. The real message size for both binary and non-binary logs is ~4076 bytes. #define LOGGER_ENTRY_MAX_LEN (4*1024) #define LOGGER_ENTRY_MAX_PAYLOAD (LOGGER_ENTRY_MAX_LEN - sizeof(struct logger_entry))

Parameters
tag
msg

Definition at line 489 of file Log.java.

◆ flushLogs()

static void flushLogs ( )
static

Call when the application/service is ending to make sure all queued logs are persisted.

Note**: This function make no guarantees about the atomicity of the insertions.

Definition at line 259 of file Log.java.

◆ getStackTraceString()

static String getStackTraceString ( Throwable  tr)
static

Handy function to get a loggable stack trace from a Throwable. This forwards to android.util.Log#getStackTraceString(Throwable tr).

Definition at line 528 of file Log.java.

◆ i() [1/2]

static int i ( String  tag,
String  msg 
)
static

Forwards information to android.util.Log#i(String tag, String msg) after adding the information to the Log Service queue.

Definition at line 391 of file Log.java.

◆ i() [2/2]

static int i ( String  tag,
String  msg,
Throwable  tr 
)
static

Forwards information to android.util.Log#i(String tag, String msg, Throwable tr) after adding the information to the Log Service queue.

Definition at line 400 of file Log.java.

◆ initialize() [1/2]

static boolean initialize ( Application  application)
static

Call on application start to enable log sync.

Parameters
applicationThe application object, as returned by context.getApplicationContext().
Returns
True if initialization succeeded, or false if it failed.

Definition at line 151 of file Log.java.

◆ initialize() [2/2]

static boolean initialize ( Application  application,
int  queueSize 
)
static

Call on application start to enable log sync.

Parameters
applicationThe application object, as returned by context.getApplicationContext().
queueSizeThe size of the memory queue before persisting logs for upload to the cloud.
Returns
True if initialization succeeded, or false if it failed.

Definition at line 175 of file Log.java.

◆ isLoggable()

static boolean isLoggable ( String  tag,
int  level 
)
static

Forwards information to android.util.Log#isLoggable(String tag, int level) after adding the information to the Log Service queue.

Definition at line 520 of file Log.java.

◆ println()

static int println ( int  priority,
String  tag,
String  msg 
)
static

Forwards information to android.util.Log#println(int priority, String tag, String msg) after adding the information to the Log Service queue. Allows full usage of the CP App priority levels.

Definition at line 537 of file Log.java.

◆ registerAdditionalDefaultExceptionHandler()

static void registerAdditionalDefaultExceptionHandler ( Thread.UncaughtExceptionHandler  exceptionHandler)
static

Allows additional default handlers to be registered and called, to enable other libraries.

Definition at line 725 of file Log.java.

◆ setAppContext()

static void setAppContext ( Context  context)
static

Primarily used for testing.

Definition at line 205 of file Log.java.

◆ unregisterAdditionalDefaultExceptionHandler()

static void unregisterAdditionalDefaultExceptionHandler ( Thread.UncaughtExceptionHandler  exceptionHandler)
static

Removes additional default handlers.

Definition at line 733 of file Log.java.

◆ updateQueueSize()

static void updateQueueSize ( int  queueSize)
static

Used to update the queue size during or after instantiation. This may not have any impact until the next log is placed in the queue.

Definition at line 189 of file Log.java.

◆ v() [1/2]

static int v ( String  tag,
String  msg 
)
static

This level is ignored by the Commerce Platform system. Forwards information to android.util.Log#v(String tag, String msg).

Definition at line 357 of file Log.java.

◆ v() [2/2]

static int v ( String  tag,
String  msg,
Throwable  tr 
)
static

This level is ignored by the Commerce Platform system. Forwards information to android.util.Log#v(String tag, String msg, Throwable tr).

Definition at line 365 of file Log.java.

◆ w() [1/3]

static int w ( String  tag,
String  msg 
)
static

Forwards information to android.util.Log#w(String tag, String msg) after adding the information to the Log Service queue.

Definition at line 409 of file Log.java.

◆ w() [2/3]

static int w ( String  tag,
String  msg,
Throwable  tr 
)
static

Forwards information to android.util.Log#w(String tag, String msg, Throwable tr) after adding the information to the Log Service queue.

Definition at line 418 of file Log.java.

◆ w() [3/3]

static int w ( String  tag,
Throwable  tr 
)
static

Forwards information to android.util.Log#w(String tag, Throwable tr) after adding the information to the Log Service queue.

Definition at line 427 of file Log.java.

◆ wtf() [1/3]

static int wtf ( String  tag,
String  msg 
)
static

Forwards information to android.util.Log#wtf(String tag, String msg) after adding the information to the Log Service queue.

Definition at line 454 of file Log.java.

◆ wtf() [2/3]

static int wtf ( String  tag,
Throwable  tr 
)
static

Forwards information to android.util.Log#wtf(String tag, Throwable tr) after adding the information to the Log Service queue.

Definition at line 463 of file Log.java.

◆ wtf() [3/3]

static int wtf ( String  tag,
String  msg,
Throwable  tr 
)
static

What a Terrible Failure: Report an exception that should never happen.

Definition at line 471 of file Log.java.

Member Data Documentation

◆ LOG_DATETIME_FORMAT

final ThreadLocal<DateFormat> LOG_DATETIME_FORMAT
static
Initial value:
= new ThreadLocal<DateFormat>() {
@SuppressLint("SimpleDateFormat")
protected DateFormat initialValue() {
return new SimpleDateFormat(DATE_PATTERN);
}
}

Definition at line 99 of file Log.java.

◆ LOG_MIME_TYPE

final String LOG_MIME_TYPE
static
Initial value:
=
"vnd.android.cursor.item/vnd.com.verifone.utilities.logs_v" + PROVIDER_VERSION

Definition at line 113 of file Log.java.

◆ LOGS_MIME_TYPE

final String LOGS_MIME_TYPE
static
Initial value:
=
"vnd.android.cursor.dir/vnd.com.verifone.utilities.logs_v" + PROVIDER_VERSION

Definition at line 111 of file Log.java.


The documentation for this class was generated from the following file:

This document is the confidential property of Verifone, Inc. Any reproduction or distribution of this document, in whole or in part, or the disclosure of any of the information contained herein, without the prior written consent of Verifone, Inc. is prohibited. This document and any supplemental material supplied as part of any review must be returned to Verifone, Inc. upon request. Notice: This document may go through material revisions over time. While the Company will make every effort to keep readers updated as changes occur, care must be taken by the reader to make sure they are reading the latest version. Version numbers appear in the title page and revision history page of this document. All rights reserved. Verifone, the Verifone logo are either trademarks or registered trademarks of Verifone in the United States and/or other countries. All other trademarks or brand names are properties of their respective holders.