In this exercise you will write some code to help Larry the Lisp Alien parse and format log strings. These log strings come in from various systems and need to be processed so that their messages can be display on an informative monitoring display.
Log strings are in the form "[<level>]: <message>". Level will be one of the following values: info, warn, or ohno.
Define a function log-message which will take a log string and evaluate to the message it contains.
(log-message "[ohno]: whoops!") ; => "whoops!"The level of the log string determines its severity.
info means a severity of :everything-okwarn means a severity of :getting-worriedohno means a severity of :run-for-coverDefine a function log-severity which will take a log string and evaluate to the correct severity.
(log-severity "[warn]: might want to get that checked") ; => :getting-worriedUnfortunately sometimes the log strings are not always formatted correctly. Specifically the log level may be not all lower case as specified above. Modify log-severity to handle this.
(log-severity "[WaRn]: string case system failing") ; => :getting-worriedDepending upon the severity the message should be modified in different ways:
:everything-ok should have its message changed to all lower-case.:getting-worried should have its message changed to have each word capitalized.:run-for-cover should have its message changed to be all upper-case.Define a function log-format that takes a log message and evaluates to a properly formatted message.
(log-format "[ohno]: whoops!") ; => WHOOPS!In this exercise you will write some code to help Larry the Lisp Alien parse and format log strings. These log strings come in from various systems and need to be processed so that their messages can be display on an informative monitoring display.
Log strings are in the form "[<level>]: <message>". Level will be one of the following values: info, warn, or ohno.
Define a function log-message which will take a log string and evaluate to the message it contains.
(log-message "[ohno]: whoops!") ; => "whoops!"The level of the log string determines its severity.
info means a severity of :everything-okwarn means a severity of :getting-worriedohno means a severity of :run-for-coverDefine a function log-severity which will take a log string and evaluate to the correct severity.
(log-severity "[warn]: might want to get that checked") ; => :getting-worriedUnfortunately sometimes the log strings are not always formatted correctly. Specifically the log level may be not all lower case as specified above. Modify log-severity to handle this.
(log-severity "[WaRn]: string case system failing") ; => :getting-worriedDepending upon the severity the message should be modified in different ways:
:everything-ok should have its message changed to all lower-case.:getting-worried should have its message changed to have each word capitalized.:run-for-cover should have its message changed to be all upper-case.Define a function log-format that takes a log message and evaluates to a properly formatted message.
(log-format "[ohno]: whoops!") ; => WHOOPS!