Loggables

com.phasmidsoftware.flog.Loggables
See theLoggables companion object
trait Loggables

Trait to define methods for rendering instances of case classes (with their various parameters), containers (Seq and Option), etc..

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Flog

Members list

Value members

Concrete methods

def anyLoggable[T]: Loggable[T]

Backstop method to yield a String from a T. NOTE: use this when you need a Loggable to log a container which includes an unsupported type.

Backstop method to yield a String from a T. NOTE: use this when you need a Loggable to log a container which includes an unsupported type.

Type parameters

T

the type of t.

Attributes

Returns

a Loggable[T] which uses toString.

def eitherLoggable[L : Loggable, R : Loggable]: Loggable[Either[L, R]]

Method to return a Loggable[ Either[L, R] ].

Method to return a Loggable[ Either[L, R] ].

Type parameters

L

the "left" type of any Either which is to be logged.

R

the "right" type of any Either which is to be logged.

Attributes

Returns

a Loggable[ Either[L, R] ].

def iterableLoggable[T : Loggable](bookends: String, atLeast: Int): Loggable[Iterable[T]]

Method to create a Loggable of an Iterable[T]. The elements of the result are then logged utilizing the !! method.

Method to create a Loggable of an Iterable[T]. The elements of the result are then logged utilizing the !! method.

Type parameters

T

the underlying type of the elements to be logged. Must provide evidence of Loggable[T].

Value parameters

atLeast

the minimum number of elements to show in the log message before the ellipsis section starts.

bookends

(optional) a String of length two specifying the first and last characters of the resulting String for a given Iterable. Defaults to "[]".

Attributes

Returns

Loggable[ Iterable[T] ].

def kVLoggable[K : Loggable, V : Loggable]: Loggable[(K, V)]

This method creates a Loggable instance which works for a tuple (a K-V pair). It is an alternative to loggable2 but that method names the members whereas we don't want them named here.

This method creates a Loggable instance which works for a tuple (a K-V pair). It is an alternative to loggable2 but that method names the members whereas we don't want them named here.

Type parameters

K

the key type.

V

the value type.

Attributes

Returns

a Loggable[(K, V)].

def loggable1[P0 : Loggable, T <: Product : ClassTag](construct: P0 => T, fields: Seq[String]): Loggable[T]

Method to return a Loggable[T] where T is a 1-ary Product and which is based on a function to convert a P0 into a T.

Method to return a Loggable[T] where T is a 1-ary Product and which is based on a function to convert a P0 into a T.

NOTE: be careful using this particular method it only applies where T is a 1-tuple (e.g. a case class with one field -- not common). It probably shouldn't ever be used in practice. It can cause strange initialization errors!

Type parameters

P0

the type of the (single) field of the Product type T.

T

the underlying type of the first parameter of the input to the render method.

Value parameters

construct

a function P0 => T, usually the apply method of a case class. The sole purpose of this function is for type inference--it is never actually invoked.

fields

(optional parameter) an explicit list of one field name.

Attributes

Returns

a Loggable[T].

def loggable2[P0 : Loggable, P1 : Loggable, T <: Product : ClassTag](construct: (P0, P1) => T, fields: Seq[String]): Loggable[T]

Method to return a Loggable[T] where T is a 2-ary Product and which is based on a function to convert a (P0, P1) into a T.

Method to return a Loggable[T] where T is a 2-ary Product and which is based on a function to convert a (P0, P1) into a T.

Type parameters

P0

the type of the first field of the Product type T.

P1

the type of the second field of the Product type T.

T

the underlying type of the first parameter of the input to the render method.

Value parameters

construct

a function (P0, P1) => T, usually the apply method of a case class. The sole purpose of this function is for type inference--it is never actually invoked.

fields

(optional parameter) an explicit list of 2 field names.

Attributes

Returns

a Loggable[T].

def loggable3[P0 : Loggable, P1 : Loggable, P2 : Loggable, T <: Product : ClassTag](construct: (P0, P1, P2) => T, fields: Seq[String]): Loggable[T]

Method to return a Loggable[T] where T is a 3-ary Product and which is based on a function to convert a (P0, P1, P2) into a T.

Method to return a Loggable[T] where T is a 3-ary Product and which is based on a function to convert a (P0, P1, P2) into a T.

Type parameters

P0

the type of the first field of the Product type T.

P1

the type of the second field of the Product type T.

P2

the type of the third field of the Product type T.

T

the underlying type of the first parameter of the input to the render method.

Value parameters

construct

a function (P0, P1, P2) => T, usually the apply method of a case class. The sole purpose of this function is for type inference--it is never actually invoked.

fields

(optional parameter) an explicit list of 3 field names.

Attributes

Returns

a Loggable[T].

def loggable4[P0 : Loggable, P1 : Loggable, P2 : Loggable, P3 : Loggable, T <: Product : ClassTag](construct: (P0, P1, P2, P3) => T, fields: Seq[String]): Loggable[T]

Method to return a Loggable[T] where T is a 4-ary Product and which is based on a function to convert a (P0, P1, P2, P3) into a T.

Method to return a Loggable[T] where T is a 4-ary Product and which is based on a function to convert a (P0, P1, P2, P3) into a T.

Type parameters

P0

the type of the first field of the Product type T.

P1

the type of the second field of the Product type T.

P2

the type of the third field of the Product type T.

P3

the type of the fourth field of the Product type T.

T

the underlying type of the first parameter of the input to the render method.

Value parameters

construct

a function (P0, P1, P2, P3) => T, usually the apply method of a case class. The sole purpose of this function is for type inference--it is never actually invoked.

fields

(optional parameter) an explicit list of 4 field names.

Attributes

Returns

a Loggable[T].

def loggable5[P0 : Loggable, P1 : Loggable, P2 : Loggable, P3 : Loggable, P4 : Loggable, T <: Product : ClassTag](construct: (P0, P1, P2, P3, P4) => T, fields: Seq[String]): Loggable[T]

Method to return a Loggable[T] where T is a 5-ary Product and which is based on a function to convert a (P0, P1, P2, P3, P4) into a T.

Method to return a Loggable[T] where T is a 5-ary Product and which is based on a function to convert a (P0, P1, P2, P3, P4) into a T.

Type parameters

P0

the type of the first field of the Product type T.

P1

the type of the second field of the Product type T.

P2

the type of the third field of the Product type T.

P3

the type of the fourth field of the Product type T.

P4

the type of the fifth field of the Product type T.

T

the underlying type of the first parameter of the input to the render method.

Value parameters

construct

a function (P0, P1, P2, P3, P4) => T, usually the apply method of a case class. The sole purpose of this function is for type inference--it is never actually invoked.

fields

(optional parameter) an explicit list of 5 field names.

Attributes

Returns

a Loggable[T].

def loggable6[P0 : Loggable, P1 : Loggable, P2 : Loggable, P3 : Loggable, P4 : Loggable, P5 : Loggable, T <: Product : ClassTag](construct: (P0, P1, P2, P3, P4, P5) => T, fields: Seq[String]): Loggable[T]

Method to return a Loggable[T] where T is a 6-ary Product and which is based on a function to convert a (P0, P1, P2, P3, P4, P5) into a T.

Method to return a Loggable[T] where T is a 6-ary Product and which is based on a function to convert a (P0, P1, P2, P3, P4, P5) into a T.

Type parameters

P0

the type of the first field of the Product type T.

P1

the type of the second field of the Product type T.

P2

the type of the third field of the Product type T.

P3

the type of the fourth field of the Product type T.

P4

the type of the fifth field of the Product type T.

P5

the type of the sixth field of the Product type T.

T

the underlying type of the first parameter of the input to the render method.

Value parameters

construct

a function (P0, P1, P2, P3, P4, P5) => T, usually the apply method of a case class. The sole purpose of this function is for type inference--it is never actually invoked.

fields

(optional parameter) an explicit list of 6 field names.

Attributes

Returns

a Loggable[T].

def loggable7[P0 : Loggable, P1 : Loggable, P2 : Loggable, P3 : Loggable, P4 : Loggable, P5 : Loggable, P6 : Loggable, T <: Product : ClassTag](construct: (P0, P1, P2, P3, P4, P5, P6) => T, fields: Seq[String]): Loggable[T]

Method to return a Loggable[T] where T is a 7-ary Product and which is based on a function to convert a (P0, P1, P2, P3, P4, P5, P6) into a T.

Method to return a Loggable[T] where T is a 7-ary Product and which is based on a function to convert a (P0, P1, P2, P3, P4, P5, P6) into a T.

Type parameters

P0

the type of the first field of the Product type T.

P1

the type of the second field of the Product type T.

P2

the type of the third field of the Product type T.

P3

the type of the fourth field of the Product type T.

P4

the type of the fifth field of the Product type T.

P5

the type of the sixth field of the Product type T.

P6

the type of the seventh field of the Product type T.

T

the underlying type of the first parameter of the input to the render method.

Value parameters

construct

a function (P0, P1, P2, P3, P4, P5, P6) => T, usually the apply method of a case class. The sole purpose of this function is for type inference--it is never actually invoked.

fields

(optional parameter) an explicit list of 7 field names.

Attributes

Returns

a Loggable[T].

def loggable8[P0 : Loggable, P1 : Loggable, P2 : Loggable, P3 : Loggable, P4 : Loggable, P5 : Loggable, P6 : Loggable, P7 : Loggable, T <: Product : ClassTag](construct: (P0, P1, P2, P3, P4, P5, P6, P7) => T, fields: Seq[String]): Loggable[T]

Method to return a Loggable[T] where T is a 8-ary Product and which is based on a function to convert a (P0, P1, P2, P3, P4, P5, P6, P7) into a T.

Method to return a Loggable[T] where T is a 8-ary Product and which is based on a function to convert a (P0, P1, P2, P3, P4, P5, P6, P7) into a T.

Type parameters

P0

the type of the first field of the Product type T.

P1

the type of the second field of the Product type T.

P2

the type of the third field of the Product type T.

P3

the type of the fourth field of the Product type T.

P4

the type of the fifth field of the Product type T.

P5

the type of the sixth field of the Product type T.

P6

the type of the seventh field of the Product type T.

P7

the type of the eighth field of the Product type T.

T

the underlying type of the first parameter of the input to the render method.

Value parameters

construct

a function (P0, P1, P2, P3, P4, P5, P6, P7) => T, usually the apply method of a case class. The sole purpose of this function is for type inference--it is never actually invoked.

fields

(optional parameter) an explicit list of 8 field names.

Attributes

Returns

a Loggable[T].

def loggable9[P0 : Loggable, P1 : Loggable, P2 : Loggable, P3 : Loggable, P4 : Loggable, P5 : Loggable, P6 : Loggable, P7 : Loggable, P8 : Loggable, T <: Product : ClassTag](construct: (P0, P1, P2, P3, P4, P5, P6, P7, P8) => T, fields: Seq[String]): Loggable[T]

Method to return a Loggable[T] where T is a 9-ary Product and which is based on a function to convert a (P0, P1, P2, P3, P4, P5, P6, P7, P8) into a T.

Method to return a Loggable[T] where T is a 9-ary Product and which is based on a function to convert a (P0, P1, P2, P3, P4, P5, P6, P7, P8) into a T.

Type parameters

P0

the type of the first field of the Product type T.

P1

the type of the second field of the Product type T.

P2

the type of the third field of the Product type T.

P3

the type of the fourth field of the Product type T.

P4

the type of the fifth field of the Product type T.

P5

the type of the sixth field of the Product type T.

P6

the type of the seventh field of the Product type T.

P7

the type of the eighth field of the Product type T.

P8

the type of the ninth field of the Product type T.

T

the underlying type of the first parameter of the input to the render method.

Value parameters

construct

a function (P0, P1, P2, P3, P4, P5, P6, P7, P8) => T, usually the apply method of a case class. The sole purpose of this function is for type inference--it is never actually invoked.

fields

(optional parameter) an explicit list of 9 field names.

Attributes

Returns

a Loggable[T].

def mapLoggable[K, T : Loggable](bookends: String): Loggable[Map[K, T]]

Method to return a Loggable[ Map[K, T] ].

Method to return a Loggable[ Map[K, T] ].

NOTE: unless the Map (passed as the bound variable) is a SeqMap, the order of the key-value pairs is undefined.

Type parameters

K

the type of the keys.

T

the underlying type of the values.

Value parameters

bookends

(optional) a String of length two specifying the first and last characters of the resulting String for a given Map. Defaults to "{}".

Attributes

Returns

a Loggable[ Map[K, T] ]

def optionLoggable[T : Loggable]: Loggable[Option[T]]

Method to return a Loggable[ Option[T] ].

Method to return a Loggable[ Option[T] ].

Type parameters

T

the underlying type of the first parameter of the input to the render method.

Attributes

Returns

a Loggable[ Option[T] ].

def triedIterableLoggable[X, Y : Loggable](f: X => Try[Y]): Loggable[Iterable[X]]

TESTME

TESTME

Method which maps an Iterable of X with a function to an Iterable of Try[Y]. The elements of the result are then logged utilizing the !! method. NOTE that the returned value will only include the successful elements.

Type parameters

X

the underlying type of xs.

Y

the underlying type of the intermediate type (must be Loggable).

Value parameters

f

a function X => Try[Y].

Attributes

Returns

an Iterable of Try[Y] such that all the failures have been logged but not included in the result.

def tryLoggable[T : Loggable]: Loggable[Try[T]]

Method to return a Loggable[ Try[T] ].

Method to return a Loggable[ Try[T] ].

Type parameters

T

the underlying type of the first parameter of the input to the render method.

Attributes

Returns

a Loggable[ Try[T] ].