Class Logger
- java.lang.Object
-
- com.avpkit.ferry.Logger
-
public class Logger extends java.lang.Object
Internal Only
C++ wrapper to SLF4J Java Logging frame work.
If not running inside a JVM, then this class
just does a rudimentary printout of log messages
to stderr.
Otherwise, it forwards to Java's SLF4J logging framework.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLogger.LevelDifferent logging levels (noiseness) supported by us.
-
Field Summary
Fields Modifier and Type Field Description protected booleanswigCMemOwnInternal Only.
-
Constructor Summary
Constructors Modifier Constructor Description protectedLogger(long cPtr, boolean cMemoryOwn)Internal Only.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandebug(java.lang.String filename, int lineNo, java.lang.String format)voiddelete()Releases any underlying native memory and marks this object as invalid.booleanequals(java.lang.Object obj)Compares two values, returning true if the underlying objects in native code are the same object.booleanerror(java.lang.String filename, int lineNo, java.lang.String format)protected voidfinalize()Internal Only.static longgetCPtr(Logger obj)Internal Only.static LoggergetLogger(java.lang.String aLoggerName)Returns a new Logger object for this loggerName.
longgetMyCPtr()Internal Only.java.lang.StringgetName()static LoggergetStaticLogger(java.lang.String aLoggerName)Get a Logger object, but ask the Logger code to
free it up once the JavaVM shuts down.inthashCode()Get a hashable value for this object.booleaninfo(java.lang.String filename, int lineNo, java.lang.String format)static booleanisGlobalLogging(Logger.Level level)booleanisLogging(Logger.Level level)booleanlog(java.lang.String filename, int lineNo, Logger.Level level, java.lang.String format)Log the message to the logger, using sprintf() format
strings.
static voidsetGlobalIsLogging(Logger.Level level, boolean value)voidsetIsLogging(Logger.Level level, boolean value)booleantrace(java.lang.String filename, int lineNo, java.lang.String format)booleanwarn(java.lang.String filename, int lineNo, java.lang.String format)
-
-
-
Field Detail
-
swigCMemOwn
protected boolean swigCMemOwn
Internal Only.
-
-
Constructor Detail
-
Logger
protected Logger(long cPtr, boolean cMemoryOwn)
Internal Only. DO NOT USE: Do not allocate this method using new. Not part of public API.Unfortunately this constructor is public because the internal implementation needs it to be, but do not pass in values to this method as you may end up crashing the virtual machine.
- Parameters:
cPtr- A C pointer to direct memory; did we mention don't call this.cMemoryOwn- I'm not even going to tell you. Stop it. Go away.
-
-
Method Detail
-
getCPtr
public static long getCPtr(Logger obj)
Internal Only. Not part of public API. Get the raw value of the native object that obj is proxying for.- Parameters:
obj- The java proxy object for a native object.- Returns:
- The raw pointer obj is proxying for.
-
getMyCPtr
public long getMyCPtr()
Internal Only. Not part of public API. Get the raw value of the native object that we're proxying for.- Returns:
- The raw pointer we're proxying for.
-
equals
public boolean equals(java.lang.Object obj)
Compares two values, returning true if the underlying objects in native code are the same object. That means you can have two different Java objects, but when you do a comparison, you'll find out they are the EXACT same object.- Overrides:
equalsin classjava.lang.Object- Returns:
- True if the underlying native object is the same. False otherwise.
-
hashCode
public int hashCode()
Get a hashable value for this object.- Overrides:
hashCodein classjava.lang.Object- Returns:
- the hashable value.
-
finalize
protected void finalize()
Internal Only. Finalize this object. Note this should only exists on non RefCounted objects.- Overrides:
finalizein classjava.lang.Object
-
delete
public void delete()
Releases any underlying native memory and marks this object as invalid.Normally Ferry manages when to release native memory.
In the unlikely event you want to control EXACTLY when a native object is released, each AVPKit object has a
delete()method that you can use. Once you calldelete(), you must ENSURE your object is never referenced again from that Java object -- Ferry tries to help you avoid crashes if you accidentally use an object after deletion but on this but we cannot offer 100% protection (specifically if another thread is accessing that object EXACTLY when youdelete()it).
-
getLogger
public static Logger getLogger(java.lang.String aLoggerName)
Returns a new Logger object for this loggerName.
- Parameters:
aLoggerName- A name (no spaces allowed) for this logger.
- Returns:
- a New logger for logging; caller must delete when done.
-
getStaticLogger
public static Logger getStaticLogger(java.lang.String aLoggerName)
Get a Logger object, but ask the Logger code to
free it up once the JavaVM shuts down. Use at your
own risk.
- Parameters:
aLoggerName- A name (no spaces allowed) for this logger.
- Returns:
- A new logger for logging; caller must not call delete
and must not use the logger once the JavaVM (or main) has exited.
-
log
public boolean log(java.lang.String filename, int lineNo, Logger.Level level, java.lang.String format)
Log the message to the logger, using sprintf() format
strings.
- Parameters:
filename- The filename that is logging, or NULL.lineNo- The line number where this log statement is executed from.
or 0.level- Level to log at.format- A format specification string, in sprintf format.- Returns:
- if the message was actually logged.
-
error
public boolean error(java.lang.String filename, int lineNo, java.lang.String format)
-
warn
public boolean warn(java.lang.String filename, int lineNo, java.lang.String format)
-
info
public boolean info(java.lang.String filename, int lineNo, java.lang.String format)
-
debug
public boolean debug(java.lang.String filename, int lineNo, java.lang.String format)
-
trace
public boolean trace(java.lang.String filename, int lineNo, java.lang.String format)
-
isLogging
public boolean isLogging(Logger.Level level)
-
setIsLogging
public void setIsLogging(Logger.Level level, boolean value)
-
isGlobalLogging
public static boolean isGlobalLogging(Logger.Level level)
-
setGlobalIsLogging
public static void setGlobalIsLogging(Logger.Level level, boolean value)
-
getName
public java.lang.String getName()
-
-