Format log data into a log entry String.

@param msgLogLevel Log level of an entry.
@param tag         Tag with SDK and version details.
@param msg         Log message.
@param exception   Exception with a stach
@return Formatted log entry.
512030
String formatMessage(int msgLogLevel, String tag, String msg, Throwable exception) {
        if (exception != null) {
            return DateHelper.getUTC(System.currentTimeMillis()) + "/" + getLevelTag(msgLogLevel) + tag + ": " + msg + "\n" + getStackTrace(exception) + "\n";
        } else {
            return DateHelper.getUTC(System.currentTimeMillis()) + "/" + getLevelTag(msgLogLevel) + tag + ": " + msg + "\n";
        }
    }
1312845
static void log(Object targetObj, String msg) {
        if (EventsParams.isDebug()) {
            Log.d(TAG, toLogStr(targetObj, msg));
        }
    }
881189
public static void d(String tag, String msg, Object... args) {
        if (sLevel > LEVEL_DEBUG) {
            return;
        }
        if (args.length > 0) {
            msg = String.format(msg, args);
        }
        Log.d(tag, msg);
    }
1152185
@Override
    protected void log(final String msg) {
        if (config.getLogLevel().equals(LogLevel.DEBUG)) {
            logger.debug(msg);
        } else if (config.getLogLevel().equals(LogLevel.TRACE)) {
            logger.trace(msg);
        } else if (config.getLogLevel().equals(LogLevel.INFO)) {
            logger.info(msg);
        } else if (config.getLogLevel().equals(LogLevel.WARN)) {
            logger.warn(msg);
        } else if (config.getLogLevel().equals(LogLevel.ERROR)) {
            logger.error(msg);
        }
    }
1150577
public static int d(String tag, String msg) {
        return d(SUBSYSTEM.MAIN, tag, msg);
    }
246799
public static void i(String msg, Throwable thr) {
        if (DEBUG)
            Log.i(TAG, buildMessage(msg), thr);
    }
210008
protected void logException (final Throwable t, final String msg, final Object[] messageParams) {
		logger.error(msg, messageParams, t);
	}
42128
public static int v(String tag, String msg) {
        return v(SUBSYSTEM.MAIN, tag, msg);
    }
1068746
public void fine(String msg) {
        if (Level.FINE.intValue() < levelValue) {
            return;
        }
        log(Level.FINE, msg);
    }
540528
public void d(final String msg) {
        logMgr.log(tag, LogLevelConst.DEBUG, msg, null);
    }
483411
private void doPrintln(long timeMillis, int logLevel, String tag, String msg) {
    String lastFileName = writer.getLastFileName();
    if (lastFileName == null || fileNameGenerator.isFileNameChangeable()) {
      String newFileName = fileNameGenerator.generateFileName(logLevel, System.currentTimeMillis());
      if (newFileName == null || newFileName.trim().length() == 0) {
        throw new IllegalArgumentException("File name should not be empty.");
      }
      if (!newFileName.equals(lastFileName)) {
        if (writer.isOpened()) {
          writer.close();
        }
        cleanLogFilesIfNecessary();
        if (!writer.open(newFileName)) {
          return;
        }
        lastFileName = newFileName;
      }
    }

    File lastFile = writer.getFile();
    if (backupStrategy.shouldBackup(lastFile)) {
      // Backup the log file, and create a new log file.
      writer.close();
      File backupFile = new File(folderPath, lastFileName + ".bak");
      if (backupFile.exists()) {
        backupFile.delete();
      }
      lastFile.renameTo(backupFile);
      if (!writer.open(lastFileName)) {
        return;
      }
    }
    String flattenedLog = flattener.flatten(timeMillis, logLevel, tag, msg).toString();
    writer.appendLog(flattenedLog);
  }
1142664
public static void log(int logLevel, String msg, Throwable tr) {
    assertInitialization();
    sLogger.log(logLevel, msg, tr);
  }
807956
public static int wtfStack(String tag, String msg) {
        return wtf(LOG_ID_MAIN, tag, msg, null, true);
    }
39331
public static void logV(String localTag, String msg) {
        if (getConfig().debugMode) {
            Log.v(getConfig().logTag, "[" + localTag + "] " + msg);
        }
    }
1175386
public static void e(String tag, String msg, Throwable tr) {
    if (logEnabled) {
      Log.e(tag, msg, tr);
    }
  }
1152528
void log(SessionLogEntry entry, String formattedMessage) {
        int level = entry.getLevel();
        Throwable loggedException = entry.getException();

        String msgParm;
        if ((formattedMessage == null || formattedMessage.equals("")) && loggedException != null) {
            msgParm = loggedException.toString();
        } else {
            msgParm = formattedMessage;
        }

        switch (level) {
            case 8:
                return;
            case 7: // SEVERE
                // With the persistence service, only errors will be logged.  The rest will be debug.
                String errMsg = Tr.formatMessage(_stc, "PROVIDER_ERROR_CWWKD0292E", msgParm);
                Tr.error(_tc, errMsg);
                break;
            case 6:// WARN
                String wrnMsg = Tr.formatMessage(_stc, "PROVIDER_WARNING_CWWKD0291W", msgParm);
                Tr.debug(_tc, wrnMsg); // 170432 - move warnings to debug
                break;
            case 3: // FINE
            case 2: // FINER
            case 1: // FINEST
            case 0: // TRACE
                Tr.debug(_tc, formattedMessage);
                break;
        }// end switch

        // if there is an exception - only log it to trace
        if (_tc.isDebugEnabled() && loggedException != null) {
            Tr.debug(_tc, "throwable", loggedException);
        }
    }
1072049
protected void writePropertiesToLog(Logger logger, Level level) {
    writeToLog(logger, level, getMapAsString(this.properties, separator), null);

    if (this.exception != null) {
      writeToLog(this.logger, Level.ERROR, "Error:", this.exception);
    }
  }