#C13027. Timed Log System

    ID: 42520 Type: Default 1000ms 256MiB

Timed Log System

Timed Log System

You are required to implement a simple logging system that maintains messages with their type and a timestamp. The system should support two operations:

  • log: Record a log message with a given type and message. The timestamp for the log should be generated deterministically based on a base time of \(2023\text{-}10\text{-}15\ 10:00:00\) and should increase by one second for each log entry.
  • get: Retrieve the list of logged messages in chronological order. Optionally, a type filter may be provided so that only logs of that specified type are returned.

Note: Each log command will add an entry with an auto-generated timestamp. For each get command, you must print each matched log entry on a separate line in the format: [type] [timestamp] [message].

The timestamp must be output in the following LaTeX formatted style: \(YYYY\text{-}MM\text{-}DD\ HH:MM:SS\).

inputFormat

The input begins with an integer \(Q\) (\(Q \ge 1\)) denoting the number of commands. Each of the following \(Q\) lines contains a command, which can be one of the following two forms:

  • log <type> <message>: Where <type> is one of info, warning, or error. The <message> may contain spaces.
  • get or get <type>: Retrieves all logs in chronological order. If <type> is provided, then only the logs of that type should be displayed.

outputFormat

For each get command, output the matching logs in chronological order. Each log entry should be printed on its own line in the format:

<type> <timestamp> <message>

If there are multiple get commands, the results should appear in the order the commands were processed. If a get command retrieves no logs, output nothing for that command.

## sample
2
log info A single info log
get
info 2023-10-15 10:00:00 A single info log

</p>