bytelog-0.1.3.1: Fast logging
Safe HaskellSafe-Inferred
LanguageHaskell2010

Logger

Synopsis

Types

data Logger Source #

An output channel for logs. The intent is that there is only one logger per application, opened at load time and shared across all threads.

Open

fromHandle :: Handle -> IO Logger Source #

Convert a Handle to a logger by extracting its file descriptor. Warning: the caller must ensure that the handle does not get garbage collected. This is very dangerous.

fromFd :: Fd -> IO Logger Source #

Convert a file descriptor to a logger.

Log

builder :: Logger -> Builder -> IO () Source #

Log the chunks that result from executing the byte builder.

boundedBuilder :: Logger -> Nat n -> Builder n -> IO () Source #

Log the unsliced byte array that results from executing the bounded builder.

bytes :: Logger -> Bytes -> IO () Source #

Log a byte sequence.

byteArray :: Logger -> ByteArray -> IO () Source #

Log an unsliced byte array.

cstring :: Logger -> CString -> IO () Source #

Log a NUL-terminated C string.

cstring# :: Logger -> Addr# -> IO () Source #

Log a NUL-terminated C string. Takes the unboxed equivalent of CString. This improves legibility in a common case:

cstring logger (Ptr "Initializing..."#)

This can be written more succinctly as:

cstring# logger "Initializing..."#

Flush

flush :: Logger -> IO () Source #

Flush any pending logs out to the file descriptor.