Maintainer | Toshio Ito <debug.ito@gmail.com> |
---|---|
Safe Haskell | None |
Language | Haskell2010 |
This module exports utility functions to read and parse log files from Contiki-NG applications.
Contiki-NG is a tiny operation system for wireless network devices. It supports RPL.
Synopsis
- parseFile :: Parser Timestamp -> FilePath -> IO ([FoundNodeDIO], [FoundNodeDAO])
- parseFileHandle :: Parser Timestamp -> Handle -> IO ([FoundNodeDIO], [FoundNodeDAO])
- parseFileHandleM :: (MonadIO m, MonadThrow m, MonadLogger m) => Parser Timestamp -> Handle -> m ([FoundNodeDIO], [FoundNodeDAO])
- parseStream :: (MonadThrow m, MonadLogger m) => Parser Timestamp -> ConduitT Line (Either FoundNodeDIO FoundNodeDAO) m ()
- parserFoundNodeDIO :: MonadLogger m => Parser Timestamp -> ConduitParser Line m FoundNodeDIO
- parserFoundNodeDAO :: MonadLogger m => Parser Timestamp -> ConduitParser Line m [FoundNodeDAO]
- type Line = Text
- type Parser = ReadP
- pCoojaLogHead :: Parser (Timestamp, Int)
- pCoojaLogHead' :: Parser Timestamp
- pSyslogHead :: Integer -> Maybe TimeZone -> Parser Timestamp
Parser functions
:: Parser Timestamp | Parser for log prefix |
-> FilePath | File to read |
-> IO ([FoundNodeDIO], [FoundNodeDAO]) |
Read and parse a log file from a Contiki-NG application to make
FoundNodeDIO
and FoundNodeDAO
. This function may output warning
and error messages to STDERR.
Currently this parser function supports logs from "rpl-lite" module only.
It assumes that each line of log file has prefix, and that the
prefix contains timestamp information. You have to pass the parser
for the prefix to this function. For example, if you read a log
file generated by Cooja simulator, use pCoojaLogHead'
parser.
One FoundNodeDIO
object is parsed from one block of log lines
from the rpl module. On the other hand, one or more FoundNodeDAO
objects are parsed from one block of log lines from the rpl
module. The FoundNodeDAO
objects generated from the same log
block share the same timestamp.
:: Parser Timestamp | Parser for log prefix |
-> Handle | File handle to read |
-> IO ([FoundNodeDIO], [FoundNodeDAO]) |
:: (MonadIO m, MonadThrow m, MonadLogger m) | |
=> Parser Timestamp | Parser for log prefix |
-> Handle | File handle to read |
-> m ([FoundNodeDIO], [FoundNodeDAO]) |
Same as parseFileHandle
, but in a generic monad.
Since: 0.3.0.0
:: (MonadThrow m, MonadLogger m) | |
=> Parser Timestamp | Parser for log prefix |
-> ConduitT Line (Either FoundNodeDIO FoundNodeDAO) m () |
Same as parseFile
but as an conduit.
Since: 0.3.0.0
Parser components
Parsers for line stream
:: MonadLogger m | |
=> Parser Timestamp | Text parser for log head. |
-> ConduitParser Line m FoundNodeDIO |
Parse stream of log lines for a FoundNodeDIO
.
Since: 0.3.0.0
:: MonadLogger m | |
=> Parser Timestamp | Text parser for log head. |
-> ConduitParser Line m [FoundNodeDAO] |
Parse stream of log lines for a FoundNodeDAO
.
Since: 0.3.0.0
Parser for text
pCoojaLogHead :: Parser (Timestamp, Int) Source #
Parse the head of Cooja log line, and return the timestamp and node ID.
pCoojaLogHead' :: Parser Timestamp Source #
Same as pCoojaLogHead
, but it returns the timestamp only.