Copyright | (c) Sam Truzjan 2013 |
---|---|
License | BSD3 |
Maintainer | pxqr.sta@gmail.com |
Stability | stable |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
The context contains the default values read from the udev config file, and is passed to all library operations.
Synopsis
- data UDev
- class UDevChild a where
- newUDev :: IO UDev
- freeUDev :: UDev -> IO ()
- withUDev :: (UDev -> IO a) -> IO a
- data Priority
- type Logger = UDev -> Priority -> ByteString -> Int -> ByteString -> ByteString -> IO ()
- getLogPriority :: UDev -> IO Priority
- setLogPriority :: UDev -> Priority -> IO ()
- setLogger :: UDev -> Logger -> IO ()
- defaultLogger :: Logger
- getUserdata :: UDev -> IO a
- setUserdata :: UDev -> a -> IO ()
Context
Opaque object representing the library context.
class UDevChild a where Source #
Family of udev resources.
Create udev library context. This reads the udev configuration file, and fills in the default values.
Logging
Log message priority.
Instances
Bounded Priority Source # | |
Enum Priority Source # | |
Eq Priority Source # | |
Ord Priority Source # | |
Defined in System.UDev.Context | |
Read Priority Source # | |
Show Priority Source # | |
= UDev | |
-> Priority | message priority; |
-> ByteString | position: file |
-> Int | position: line |
-> ByteString | position: function |
-> ByteString | message body |
-> IO () |
Logger function will called by udev on events.
getLogPriority :: UDev -> IO Priority Source #
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 :: Logger Source #
Default logger will just print %PRIO %FILE:%LINE:n%FN: %FORMAT
to stdout.
User data
getUserdata :: UDev -> IO a Source #
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.