Class 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 class  Logger.Level
      Different logging levels (noiseness) supported by us.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean swigCMemOwn
      Internal Only.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Logger​(long cPtr, boolean cMemoryOwn)
      Internal Only.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean debug​(java.lang.String filename, int lineNo, java.lang.String format)  
      void delete()
      Releases any underlying native memory and marks this object as invalid.
      boolean equals​(java.lang.Object obj)
      Compares two values, returning true if the underlying objects in native code are the same object.
      boolean error​(java.lang.String filename, int lineNo, java.lang.String format)  
      protected void finalize()
      Internal Only.
      static long getCPtr​(Logger obj)
      Internal Only.
      static Logger getLogger​(java.lang.String aLoggerName)
      Returns a new Logger object for this loggerName.

      long getMyCPtr()
      Internal Only.
      java.lang.String getName()  
      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.
      int hashCode()
      Get a hashable value for this object.
      boolean info​(java.lang.String filename, int lineNo, java.lang.String format)  
      static boolean isGlobalLogging​(Logger.Level level)  
      boolean isLogging​(Logger.Level level)  
      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.

      static void setGlobalIsLogging​(Logger.Level level, boolean value)  
      void setIsLogging​(Logger.Level level, boolean value)  
      boolean trace​(java.lang.String filename, int lineNo, java.lang.String format)  
      boolean warn​(java.lang.String filename, int lineNo, java.lang.String format)  
      • Methods inherited from class java.lang.Object

        clone, getClass, notify, notifyAll, toString, wait, wait, wait
    • 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:
        equals in class java.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:
        hashCode in class java.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:
        finalize in class java.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 call delete(), 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 you delete() 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)
      • getName

        public java.lang.String getName()