On 2015-08-03 10:14, Alex Bennée wrote:
> This makes it a little easier to remember how you generated that 100Mb
> trace log you saved for a future date.
>
> Signed-off-by: Alex Bennée <[email protected]>
> ---
> configure | 2 +-
> vl.c | 18 ++++++++++++++++++
> 2 files changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 704b34c..9cc6a48 100755
> --- a/configure
> +++ b/configure
> @@ -1445,7 +1445,7 @@ else
> fi
>
> gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
> -gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers
> $gcc_flags"
> +gcc_flags="-Wformat-security -Wno-format-y2k -Winit-self
> -Wignored-qualifiers $gcc_flags"
> gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
> gcc_flags="-Wendif-labels $gcc_flags"
> gcc_flags="-Wno-initializer-overrides $gcc_flags"
> diff --git a/vl.c b/vl.c
> index 05211cf..6f0ae74 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -4094,12 +4094,30 @@ int main(int argc, char **argv, char **envp)
>
> if (log_mask) {
> int mask;
> + char fmt_time[512];
> + time_t start_time = time(NULL);
> + struct tm *local_start = localtime(&start_time);
> +
> +
> + if (log_file) {
> + qemu_set_log_filename(log_file);
> + }
> +
> mask = qemu_str_to_log_mask(log_mask);
> if (!mask) {
> qemu_print_log_usage(stdout);
> exit(1);
> }
> qemu_set_log(mask);
> +
> + if (strftime(fmt_time, sizeof(fmt_time), "%c", local_start) > 0) {
Given we don't allow translation in qemu_log, shouldn't we just use a
fixed date/time format? It looks like other parts of QEMU has more or
less standardized to %Y-%m-%d %H:%M:%S, with some changes at the
separator level.
> + qemu_log("System Emulation started at %s\n", fmt_time);
> + qemu_log("Invocation:");
> + for (i = 0; i < argc; i++) {
> + qemu_log("%s ", argv[i]);
> + }
> + qemu_log("\n");
> + }
> }
>
> if (!is_daemonized()) {
Otherwise:
Reviewed-by: Aurelien Jarno <[email protected]>
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
[email protected] http://www.aurel32.net