Logger actor

Rocket.loggerFunction
logger([ io::IO ], name::String = "LogActor")
logger(::Type{T}, [ io::IO ], name::String = "LogActor") where T

Creation operator for the LoggerActor actor.

Examples

using Rocket

source = from([ 0, 1, 2 ])
subscribe!(source, logger())
;

# output

[LogActor] Data: 0
[LogActor] Data: 1
[LogActor] Data: 2
[LogActor] Completed
using Rocket

source = from([ 0, 1, 2 ])
subscribe!(source, logger("CustomName"))
;

# output

[CustomName] Data: 0
[CustomName] Data: 1
[CustomName] Data: 2
[CustomName] Completed
using Rocket

buffer = IOBuffer()

source = from([ 0, 1, 2 ])
subscribe!(source, logger(buffer, "CustomBuffer"))
;

print(String(take!(buffer)))
# output

[CustomBuffer] Data: 0
[CustomBuffer] Data: 1
[CustomBuffer] Data: 2
[CustomBuffer] Completed

See also: LoggerActor, AbstractActor

source
Rocket.LoggerActorType
LoggerActor{D}(name::String = "LogActor", io::O) where { D, O }

The LoggerActor logs all next!/error!/complete! events that are sent from an Observable.

Constructor arguments

  • name: name of the logger. Optional. Default is LogActor.
  • io: io stream to log in, maybe nothing to write to stdout

See also: Actor, logger

source