#K93247. Log Filter Challenge
Log Filter Challenge
Log Filter Challenge
You are given a series of log entries. Each log entry contains a timestamp, a log level and a message. Your task is to filter and output all log messages that meet two conditions:
- The timestamp of the log is within the specified start and end times (inclusive).
- The log's severity is at least as high as a given threshold level.
The severity levels are defined as follows:
\( DEBUG \lt INFO \lt WARNING \lt ERROR \).Note: Timestamps are provided in the format \( YYYY-MM-DD\ HH:MM:SS \) and can be compared lexicographically. The input is read from standard input and the required output is written to standard output.
inputFormat
The input will be provided in the following format from stdin:
n log1_timestamp log1_level log1_message log2_timestamp log2_level log2_message ... (repeated n times) start_time end_time level_threshold
Here, n is the number of log entries. Each log entry consists of three lines: a timestamp (in the format "YYYY-MM-DD HH:MM:SS"), a log level (one of DEBUG, INFO, WARNING, ERROR), and a log message (which may contain spaces).
outputFormat
The output should contain the filtered log messages, each printed on a new line in the order they appear in the input. If no log message matches the criteria, nothing is printed.
## sample5
2023-01-01 12:00:00
DEBUG
Debugging issue A
2023-01-01 12:05:00
INFO
Processing request B
2023-01-01 12:10:00
ERROR
Failed to process X
2023-01-01 12:15:00
INFO
Processing request C
2023-01-01 12:20:00
WARNING
Potential issue with Y
2023-01-01 12:00:00
2023-01-01 12:15:00
INFO
Processing request B
Failed to process X
Processing request C
</p>