udev-0.1.0.0: libudev bindings

Portabilityportable
Stabilitystable
Maintainerpxqr.sta@gmail.com
Safe HaskellNone

System.UDev.Context

Contents

Description

The context contains the default values read from the udev config file, and is passed to all library operations.

Synopsis

Context

data UDev Source

Opaque object representing the library context.

Instances

class UDevChild a whereSource

Family of udev resources.

Methods

getUDev :: a -> UDevSource

Get the context a resource belong to.

newUDev :: IO UDevSource

Create udev library context. This reads the udev configuration file, and fills in the default values.

withUDev :: (UDev -> IO a) -> IO aSource

Like newUDev but context will be released at exit.

Logging

data Priority Source

Log message priority.

Constructors

LogError

error conditions

LogInfo

informational

LogDebug

debug-level messages

type LoggerSource

Arguments

 = UDev 
-> Priority

message priority;

-> BS.ByteString

position: file

-> Int

position: line

-> BS.ByteString

position: function

-> BS.ByteString

message body

-> IO () 

Logger function will called by udev on events.

getLogPriority :: UDev -> IO PrioritySource

The initial logging priority is read from the udev config file at startup.

setLogPriority :: UDev -> Priority -> IO ()Source

Set the current logging priority. The value controls which messages are logged.

setLogger :: UDev -> Logger -> IO ()Source

The built-in logging writes to stderr. It can be overridden by a custom function, to plug log messages into the users' logging functionality.

defaultLogger :: LoggerSource

Default logger will just print %PRIO %FILE:%LINE:n%FN: %FORMAT to stdout.

User data

getUserdata :: UDev -> IO aSource

Retrieve stored data pointer from library context. This might be useful to access from callbacks like a custom logging function.

setUserdata :: UDev -> a -> IO ()Source

Store custom userdata in the library context.