Answered step by step
Verified Expert Solution
Question
1 Approved Answer
String - based Log Analyzer Task: Write a function log _ analyzer ( log _ string ) that analyzes a given string representing log data.
Stringbased Log Analyzer
Task: Write a function loganalyzerlogstring that analyzes a given string representing log data. The function should count the number of error
messages and return this count. An error message is identified by the keyword "ERROR" at the beginning of a line. The log data will be provided
as a single string where lines are separated by newline characters In
def loganalyzerlogstring:
# your implementation here
pass
# # Student Test Cases
# logsample "INF: User logged in
ERROR: Invalid password
INF: Security alert
ERROR: System overload"
# logsample "INF: Data updated
ERROR: Connection failed"
# logsample "WARNING: Low disk space
INF: File saved"
# assert loganalyzerlogsample
# assert loganalyzerlogsample
# assert loganalyzerlogsample
For each of the functions below, at least two examples are provided to test your functions.
functions will be tested both with examples provided in each question and with extra examples.
Each function has to be documented with docstrings In particular, each function has to have docstrings that specify: a description about what the function does while mentioning parameter names b preconditions, if any
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started