com.phasmidsoftware.flog
Members list
Type members
Classlikes
Class to represent a Logger which is based on an Appendable (which must also be AutoCloseable and Flushable.
Class to represent a Logger which is based on an Appendable (which must also be AutoCloseable and Flushable.
Value parameters
- appendable
-
an instance of Appendable with is also AutoCloseable and Flushable.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Loggertrait Flushabletrait AutoCloseableclass Objecttrait Matchableclass AnyShow all
Simple functional logging class.
Simple functional logging class.
Here are the steps you need to follow to enable logging:
-
To instantiate a new instance of Flog, specifying the class for which you are logging: simply invoke the apply method:
Flog[MyClass]. Assuming that you named the variable "flog", then "import flog._" -
Create a String which will form the log message, follow it with "!!" (info), or "!?" (debug), or other method, and follow that with the expression you want to log. The construct in this form (including the message and "!!") will yield the value of the expression.
-
Most of the time, this is all you need to do (see README.md for much more information on this).
There are several ways to turn logging off (temporarily or permanently) once you've added the log expressions:
- (0)
- configure the logger (using logback.xml or similar) to ignore the particular log level;
- (1)
- replace the !! method with the |! method for each expression you wish to silence;
- (2)
- use a disabled Flog with flog.disabled (silences all flogging everywhere);
- (3)
- remove the !! expressions.
Value parameters
- logger
-
the Logger which is to be used by this Flog.
Attributes
LogFunction which is a function of String => Unit (except that the String parameter is defined to be call-by-name). NOTE: the type of f must be (String => Any) because many suitable functions will in fact yield a non-Unit result.
LogFunction which is a function of String => Unit (except that the String parameter is defined to be call-by-name). NOTE: the type of f must be (String => Any) because many suitable functions will in fact yield a non-Unit result.
Value parameters
- f
-
a function which takes a String and returns any type. It is expected that f causes some side-effect such as writing to a log file. The actual result of invoking f is ignored.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait LogFunctionclass Objecttrait Matchableclass AnyShow all
Class to represent a Logger which is based on a LogFunction.
Class to represent a Logger which is based on a LogFunction.
Value parameters
- logFunction
-
the LogFunction.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Loggertrait Flushabletrait AutoCloseableclass Objecttrait Matchableclass AnyShow all
LogFunction which, almost, extends String => Unit. BUT, and this is a big but, if you simply write type LogFunction = String => Unit, you won't get the benefit of call-by-name parameter handling.
LogFunction which, almost, extends String => Unit. BUT, and this is a big but, if you simply write type LogFunction = String => Unit, you won't get the benefit of call-by-name parameter handling.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class GenericLogFunction
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
LogFunction.type
A type class to enable objects to be rendered laconically as Strings for the purpose of logging.
A type class to enable objects to be rendered laconically as Strings for the purpose of logging.
Type parameters
- T
-
the underlying type of the Loggable.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class LoggableOption[T]object given_LoggableOption_Intobject given_LoggableOption_Stringobject given_Loggable_BigDecimalobject given_Loggable_BigIntobject given_Loggable_Booleanobject given_Loggable_Byteobject given_Loggable_Doubleobject given_Loggable_Intobject given_Loggable_Longobject given_Loggable_Shortobject given_Loggable_Stringobject given_Loggable_Temporalobject given_Loggable_UnitShow all
Companion object to Loggable. This is where the compiler can find the various given instances of Loggable[T].
Trait to define methods for rendering instances of case classes (with their various parameters), containers (Seq and Option), etc..
A specialized exception that indicates its underlying cause has already been logged.
A specialized exception that indicates its underlying cause has already been logged.
This exception is useful in scenarios where the original exception has been logged and there's no need to log it again, minimizing duplicate logs for the same issue.
Value parameters
- e
-
the underlying cause of this exception.
Attributes
- Supertypes
-
trait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
Trait to represent a Logger.
Trait to represent a Logger.
Attributes
- Companion
- object
- Supertypes
-
trait Flushabletrait AutoCloseableclass Objecttrait Matchableclass Any
- Known subtypes
Class to create a Logger based on Slf4j (simple logging facade for Java).
Class to create a Logger based on Slf4j (simple logging facade for Java).
Value parameters
- logger
-
an instance of org.slf4j.Logger.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Loggertrait Flushabletrait AutoCloseableclass Objecttrait Matchableclass AnyShow all
Class to represent a Logger which is based on a StringBuilder.
Class to represent a Logger which is based on a StringBuilder.
Value parameters
- sb
-
an instance of StringBuilder.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Loggertrait Flushabletrait AutoCloseableclass Objecttrait Matchableclass AnyShow all