trace-cmd: Move plog() function to libtracecmd.
plog() function writes logs into a log file. It is used in
libtracecmd and its implementation should be there.
The function is moved from trace-cmd into the library and
renamed to tracecmd_plog(). Two additional APIs are implemented:
int tracecmd_set_log_file(char *logfile); - use it to set
the log file.
void tracecmd_plog_error(const char *fmt, ...); - use it to log
an error message into the file.
The plog() function is used also from pdie() in trace-cmd.
pdie() depends on trace-cmd context and cannot be moved to
the library. It is reimplemented as macros, in order to utilize
the new tracecmd_plog() library function.
Link: http://lore.kernel.org/linux-trace-devel/20190903133445.30486-3-tz.stoyanov@gmail.com
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
6 files changed