kraklin / elm-debug-parser / DebugParser


type alias ParsedLog a =
{ tag : String, value : a }

Alias to represent parsed log.

Tag is part of the log message before the first colon.

parse : Config a -> String -> Result String (ParsedLog a)

Try to parse Debug.log message.

parseValue : Config a -> String -> Result String a

This function parses only the debug value without a tag, e.g. output of Debug.toString


type alias Config a =
{ bool : Basics.Bool -> a
, string : String -> a
, char : Char -> a
, number : Basics.Float -> a
, function : a
, internals : a
, unit : a
, bytes : Basics.Int -> a
, file : String -> a
, list : List a -> a
, array : List a -> a
, set : List a -> a
, tuple : List a -> a
, customType : String -> List a -> a
, record : List ( String
, a ) -> a
, dict : List ( a
, a ) -> a 
}

Record for setting transformations for parsed output types.

You might need to transform debug values to something else than ElmValue type. Doing this after everything is parsed is quite performance heavy, so you can use this record and set the transformations that are used during parsing yourself. e.g. Json.Encode.Value, Html or just a nicer string.

defaultConfig : Config ElmValue

Default configuration for parsing debug log into ElmValue type