Initial setup
This commit is contained in:
parent
22debc12d7
commit
f6d7a9e183
3 changed files with 5562 additions and 0 deletions
28
Lecture 03/LogAnalysis/LogAnalysis.hs
Normal file
28
Lecture 03/LogAnalysis/LogAnalysis.hs
Normal file
|
@ -0,0 +1,28 @@
|
|||
module LogAnalysis where
|
||||
|
||||
import Text.Read ( readMaybe )
|
||||
|
||||
data MessageType = Info
|
||||
| Warning
|
||||
| Error Int
|
||||
deriving (Show, Eq)
|
||||
|
||||
type Timestamp = Int
|
||||
|
||||
data LogMessage = LogMessage MessageType Timestamp String
|
||||
deriving (Show, Eq)
|
||||
|
||||
data MaybeLogMessage = ValidLM LogMessage
|
||||
| InvalidLM String
|
||||
deriving (Show, Eq)
|
||||
|
||||
data MaybeInt = ValidInt Int
|
||||
| InvalidInt
|
||||
deriving (Show, Eq)
|
||||
|
||||
readInt :: String -> MaybeInt
|
||||
readInt s
|
||||
| Just i <- readMaybe s = ValidInt i
|
||||
| otherwise = InvalidInt
|
||||
|
||||
-- parseMessage :: String -> MaybeLogMessage
|
5523
Lecture 03/LogAnalysis/error.log
Normal file
5523
Lecture 03/LogAnalysis/error.log
Normal file
File diff suppressed because it is too large
Load diff
11
Lecture 03/LogAnalysis/sample.log
Normal file
11
Lecture 03/LogAnalysis/sample.log
Normal file
|
@ -0,0 +1,11 @@
|
|||
I 6 Completed armadillo processing
|
||||
I 1 Nothing to report
|
||||
I 4 Everything normal
|
||||
I 11 Initiating self-destruct sequence
|
||||
E 70 3 Way too many pickles
|
||||
E 65 8 Bad pickle-flange interaction detected
|
||||
W 5 Flange is due for a check-up
|
||||
I 7 Out for lunch, back in two time steps
|
||||
E 20 2 Too many pickles
|
||||
I 9 Back from lunch
|
||||
E 99 10 Flange failed!
|
Loading…
Reference in a new issue