← 返回 oracle 的题目列表Log Line Formatter: Timestamp and Level Conversion
类型:online_judge
oracle
Write a program that converts a single line log into a fixed format output. Each log line contains a timestamp, a log level, and a log message, in the format:
1689200791 INFO some log
The output should include:
Standard time format
The log level in uppercase
The log message
Assume the input format is valid.
Input
A single string containing a timestamp, level, and message.
Output
Convert the timestamp to a human-readable format, in the format:
[YYYY-MM-DD HH:MM:SS] [LEVEL] message
Example
Input:
1689200791 INFO some log
Output:
[2023-07-12 10:59:51] [INFO] some log
Example
Input
1689200791 INFO some log