com.alarexgroup.m2mplf.logging
Class Logger

java.lang.Object
  extended by com.alarexgroup.m2mplf.logging.Logger
public class Logger
extends java.lang.Object

This class provides logging in several levels and on different channels.
Example:

Logger.logInfo("Application started!");

Anywhere in application is possible to use just Logger.log... Logging is in every application automaticaly initialized and saving processes into m2m_timestamp.log file

Field Summary
static int LEVEL_DEBUG
          All records ERROR, INFO, DEBUG
static int LEVEL_ERROR
          Only ERROR records
static int LEVEL_INFO
          Only ERROR or INFO records
static java.lang.String[] LEVEL_LABELS
          Standard level setting
static int LEVEL_NONE
          No records
static int LOG_OUTPUT_BUFFER
          Logging into internal buffer - debugger can read from logBuffer variable
static int LOG_OUTPUT_FILE
          Logging into file, standard a:/m2m_timestamp.log
static java.lang.String[] LOG_OUTPUT_LABELS
          Standard output setting
static int LOG_OUTPUT_NONE
          Record will be lost - no logging
static int LOG_OUTPUT_SERIAL
          Logging on ASCO, blocking, baudrate 115200
static int LOG_OUTPUT_STD_OUT
          Logging on STD_OUTPUT
 
Constructor Summary
Logger()
           
 
Method Summary
static void clearLogBuffer()
          Erases logBuffer
static java.lang.String getLogBuffer()
          Method returns log buffer content
static void logDebug(java.lang.String message)
          Record into log on level DEBUG
static void logError(java.lang.String message)
          Record into log on level ERROR
static void logError(java.lang.Throwable throwable)
          Rocord into log on level ERROR
static void logFileClose()
          Closes the logfile
static void logInfo(java.lang.String message)
          Rocord into log on level INFO
static void setLogCOM(java.lang.String comSerial)
          Sets serial port for logging
static void setLogFilename(java.lang.String filename)
          Log. file's name setting
static void setLoggingLevel(int level)
          This method configures which levels of messages will be passed to outputs
static void setLoggingOutput(int output)
          This method configures output's logging channels.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEVEL_NONE

public static final int LEVEL_NONE
No records

See Also:
Constant Field Values

LEVEL_ERROR

public static final int LEVEL_ERROR
Only ERROR records

See Also:
Constant Field Values

LEVEL_INFO

public static final int LEVEL_INFO
Only ERROR or INFO records

See Also:
Constant Field Values

LEVEL_DEBUG

public static final int LEVEL_DEBUG
All records ERROR, INFO, DEBUG

See Also:
Constant Field Values

LEVEL_LABELS

public static final java.lang.String[] LEVEL_LABELS
Standard level setting

LOG_OUTPUT_NONE

public static int LOG_OUTPUT_NONE
Record will be lost - no logging

LOG_OUTPUT_STD_OUT

public static int LOG_OUTPUT_STD_OUT
Logging on STD_OUTPUT

LOG_OUTPUT_FILE

public static int LOG_OUTPUT_FILE
Logging into file, standard a:/m2m_timestamp.log

LOG_OUTPUT_SERIAL

public static int LOG_OUTPUT_SERIAL
Logging on ASCO, blocking, baudrate 115200

LOG_OUTPUT_BUFFER

public static int LOG_OUTPUT_BUFFER
Logging into internal buffer - debugger can read from logBuffer variable

See Also:
getLogBuffer()

LOG_OUTPUT_LABELS

public static final java.lang.String[] LOG_OUTPUT_LABELS
Standard output setting

Constructor Detail

Logger

public Logger()
Method Detail

setLoggingLevel

public static void setLoggingLevel(int level)
This method configures which levels of messages will be passed to outputs

Parameters:
level - - DEBUG,ERROR,INF

setLoggingOutput

public static void setLoggingOutput(int output)
This method configures output's logging channels. For example: setLoggingOutput(Logger.LOG_OUTPUT_FILE | Logger.LOG_OUTPUT_SERIAL)

Parameters:
output - for example: Logger.LOG_OUTPUT_FILE | Logger.LOG_OUTPUT_SERIAL
Logging into file and on serial port at the same time.

setLogFilename

public static void setLogFilename(java.lang.String filename)
Log. file's name setting

Parameters:
filename - file name

setLogCOM

public static void setLogCOM(java.lang.String comSerial)
Sets serial port for logging

Parameters:
comSerial - serial port

logDebug

public static void logDebug(java.lang.String message)
Record into log on level DEBUG

Parameters:
message - recording text

logError

public static void logError(java.lang.String message)
Record into log on level ERROR

Parameters:
message - text

logError

public static void logError(java.lang.Throwable throwable)
Rocord into log on level ERROR

Parameters:
throwable - exception to be logged

logInfo

public static void logInfo(java.lang.String message)
Rocord into log on level INFO

Parameters:
message -

getLogBuffer

public static java.lang.String getLogBuffer()
Method returns log buffer content

Returns:
content of log buffer

clearLogBuffer

public static void clearLogBuffer()
Erases logBuffer

logFileClose

public static void logFileClose()
Closes the logfile