tracecmd: Set default log to INFO and remove unnecessary newlines
PATCH 1/1 tracecmd: Set default log to INFO and remove unnecessary newlines
From: "Steven Rostedt (Google)" <[email protected]>
Set the default logging of trace-cmd report to INFO. This will not affect the tep functions, as tep will still use whatever its default is. But it does allow for normal prints to be shown by default.
For example, the version of the file that is being read should be reported by default as it use to be.
Also remove all the unnecessary newlines that are added to the tracecmd_info/warning/critical() functions, as they supply the newlines.
Signed-off-by Steven Rostedt (Google) <[email protected]>
--- lib/trace-cmd/trace-hooks.c | 2 +- lib/trace-cmd/trace-input.c | 12 ++++++------ lib/trace-cmd/trace-msg.c | 6 +++--- lib/trace-cmd/trace-output.c | 6 +++--- lib/trace-cmd/trace-plugin.c | 10 +++++----- lib/trace-cmd/trace-util.c | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-)
lib/trace-cmd/trace-hooks.c +1 -1
@@ -133,7 +133,7 @@ struct hook_list *tracecmd_create_event_hook(const char *arg) hook->stack =1 ;break ;default : -tracecmd_warning ("unknown flag %c\n" , flags[i]); +tracecmd_warning ("unknown flag %c" , flags[i]); } } }
lib/trace-cmd/trace-input.c +6 -6
@@ -1532,7 +1532,7 @@ static void __free_page(struct tracecmd_input *handle, struct page *page)int index;if (!page->ref_count) { -tracecmd_critical ("Page ref count is zero!\n" ); +tracecmd_critical ("Page ref count is zero!" );return ; }
@@ -4168,7 +4168,7 @@ struct tracecmd_input *tracecmd_alloc_fd(int fd, int flags) version =read_string (handle);if (!version) goto failed_read; -tracecmd_info ("version = %s\n" , version); +tracecmd_info ("version = %s" , version); ver =strtol (version,NULL ,10 );if (!ver && errno) goto failed_read;
@@ -4396,7 +4396,7 @@ void tracecmd_close(struct tracecmd_input *handle)return ;if (handle->ref <=0 ) { -tracecmd_warning ("tracecmd: bad ref count on handle\n" ); +tracecmd_warning ("tracecmd: bad ref count on handle" );return ; }
@@ -5493,7 +5493,7 @@ tracecmd_buffer_instance_handle(struct tracecmd_input *handle, int indx) ret =lseek64 (handle->fd, buffer->offset,SEEK_SET );if (ret == (off64_t)-1 ) { -tracecmd_warning ("could not seek to buffer %s offset %ld\n" , +tracecmd_warning ("could not seek to buffer %s offset %ld" , buffer->name, buffer->offset); goto error; }
@@ -5507,12 +5507,12 @@ tracecmd_buffer_instance_handle(struct tracecmd_input *handle, int indx) ret =read_cpu_data (new_handle);if (ret <0 ) { -tracecmd_warning ("failed to read sub buffer %s\n" , buffer->name); +tracecmd_warning ("failed to read sub buffer %s" , buffer->name); goto error; } ret =lseek64 (handle->fd, offset,SEEK_SET );if (ret <0 ) { -tracecmd_warning ("could not seek to back to offset %ld\n" , offset); +tracecmd_warning ("could not seek to back to offset %ld" , offset); goto error; } }else {
lib/trace-cmd/trace-msg.c +3 -3
@@ -430,7 +430,7 @@ void tracecmd_msg_set_done(struct tracecmd_msg_handle *msg_handle)static void error_operation (struct tracecmd_msg *msg) { -tracecmd_warning ("Message: cmd=%d size=%d\n" ,ntohl (msg->hdr.cmd),ntohl (msg->hdr.size)); +tracecmd_warning ("Message: cmd=%d size=%d" ,ntohl (msg->hdr.cmd),ntohl (msg->hdr.size)); }/*
@@ -460,7 +460,7 @@ static int tracecmd_msg_wait_for_msg(int fd, struct tracecmd_msg *msg) ret =tracecmd_msg_recv_wait (fd, msg);if (ret <0 ) {if (ret == -ETIMEDOUT ) -tracecmd_warning ("Connection timed out\n" ); +tracecmd_warning ("Connection timed out" );return ret; }
@@ -651,7 +651,7 @@ int tracecmd_msg_initial_setting(struct tracecmd_msg_handle *msg_handle) ret =tracecmd_msg_recv_wait (msg_handle->fd, &msg);if (ret <0 ) {if (ret == -ETIMEDOUT ) -tracecmd_warning ("Connection timed out\n" ); +tracecmd_warning ("Connection timed out" );return ret; }
lib/trace-cmd/trace-output.c +3 -3
@@ -2277,7 +2277,7 @@ static int update_buffer_cpu_offset_v6(struct tracecmd_output *handle, b_offset =get_buffer_file_offset (handle, name);if (!b_offset) { -tracecmd_warning ("Cannot find description for buffer %s\n" , name); +tracecmd_warning ("Cannot find description for buffer %s" , name);return -1 ; }
@@ -2285,7 +2285,7 @@ static int update_buffer_cpu_offset_v6(struct tracecmd_output *handle,/* Go to the option data, where will write the offest */ if (do_lseek (handle, b_offset,SEEK_SET ) == (off64_t)-1 ) { -tracecmd_warning ("could not seek to %lld\n" , b_offset); +tracecmd_warning ("could not seek to %lld" , b_offset);return -1 ; }
@@ -2294,7 +2294,7 @@ static int update_buffer_cpu_offset_v6(struct tracecmd_output *handle,/* Go back to end of file */ if (do_lseek (handle, current,SEEK_SET ) == (off64_t)-1 ) { -tracecmd_warning ("could not seek to %lld\n" , offset); +tracecmd_warning ("could not seek to %lld" , offset);return -1 ; }return 0 ;
lib/trace-cmd/trace-plugin.c +5 -5
@@ -108,13 +108,13 @@ load_plugin(struct trace_plugin_context *trace, const char *path, ret =asprintf (&plugin,"%s/%s" , path, file);if (ret <0 ) { -tracecmd_warning ("could not allocate plugin memory\n" ); +tracecmd_warning ("could not allocate plugin memory" );return ; } handle =dlopen (plugin,RTLD_NOW |RTLD_GLOBAL );if (!handle) { -tracecmd_warning ("could not load plugin '%s'\n%s\n" , plugin,dlerror ()); +tracecmd_warning ("could not load plugin '%s'\n%s" , plugin,dlerror ()); goto out_free; }
@@ -124,14 +124,14 @@ load_plugin(struct trace_plugin_context *trace, const char *path, func =dlsym (handle,TRACECMD_PLUGIN_LOADER_NAME );if (!func) { -tracecmd_warning ("could not find func '%s' in plugin '%s'\n%s\n" , +tracecmd_warning ("could not find func '%s' in plugin '%s'\n%s" ,TRACECMD_PLUGIN_LOADER_NAME , plugin,dlerror ()); goto out_free; } list =malloc (sizeof (*list));if (!list) { -tracecmd_warning ("could not allocate plugin memory\n" ); +tracecmd_warning ("could not allocate plugin memory" ); goto out_free; }
@@ -256,7 +256,7 @@ load_plugins_hook(struct trace_plugin_context *trace, const char *suffix, ret =asprintf (&path,"%s/%s" , home,LOCAL_PLUGIN_DIR );if (ret <0 ) { -tracecmd_warning ("could not allocate plugin memory\n" ); +tracecmd_warning ("could not allocate plugin memory" );return ; }
lib/trace-cmd/trace-util.c +1 -1
@@ -30,7 +30,7 @@#define PROC_STACK_FILE "/proc/sys/kernel/stack_tracer_enabled"static bool debug; -static int log_level =TEP_LOG_CRITICAL ; +static int log_level =TEP_LOG_INFO ;static FILE *logfp; const static struct {
Signature · 1 line
2.34.1