@@ -1055,6 +1055,7 @@ sysdig_init_res sysdig_init(int argc, char **argv)
10551055 std::unique_ptr<filter_check_list> filter_list;
10561056 std::shared_ptr<sinsp_filter_factory> filter_factory;
10571057 color_term_out color_flag = COLOR;
1058+ bool user_defined_format = false ;
10581059
10591060 // These variables are for the cycle_writer engine
10601061 int duration_seconds = 0 ;
@@ -1427,6 +1428,7 @@ sysdig_init_res sysdig_init(int argc, char **argv)
14271428 output_format = optarg;
14281429 output_format_plugin = optarg;
14291430 }
1431+ user_defined_format = true ;
14301432
14311433 break ;
14321434 case ' q' :
@@ -1679,18 +1681,21 @@ sysdig_init_res sysdig_init(int argc, char **argv)
16791681 }
16801682 }
16811683
1682- char * no_color_env = getenv (" NO_COLOR" );
1683- if ((color_flag == FORCE_COLOR) ||
1684- (stdout_supports_color () && (no_color_env != nullptr && no_color_env[0 ] != ' \0 ' ) && color_flag == COLOR))
1685- {
1686- output_format = R"( *%evt.num %evt.outputtime %evt.cpu \e[01;32m%proc.name\e[00m (\e[01;36m%proc.pid\e[00m.%thread.tid) %evt.dir \e[01;34m%evt.type\e[00m %evt.info)" ;
1687- output_format_plugin = R"( *%evt.num %evt.datetime.s [\e[01;32m%evt.pluginname\e[00m] %evt.plugininfo)" ;
1688- }
1689- else
1690- {
1691- output_format = " *%evt.num %evt.outputtime %evt.cpu %proc.name (%thread.tid) %evt.dir %evt.type %evt.info" ;
1692- output_format_plugin = " *%evt.num %evt.datetime.s [%evt.pluginname] %evt.plugininfo" ;
1693- }
1684+ if (!user_defined_format)
1685+ {
1686+ char * no_color_env = getenv (" NO_COLOR" );
1687+ if ((color_flag == FORCE_COLOR) ||
1688+ (stdout_supports_color () && no_color_env == nullptr && color_flag == COLOR))
1689+ {
1690+ output_format = R"( *%evt.num %evt.outputtime %evt.cpu \e[01;32m%proc.name\e[00m (\e[01;36m%proc.pid\e[00m.%thread.tid) %evt.dir \e[01;34m%evt.type\e[00m %evt.info)" ;
1691+ output_format_plugin = R"( *%evt.num %evt.datetime.s [\e[01;32m%evt.pluginname\e[00m] %evt.plugininfo)" ;
1692+ }
1693+ else
1694+ {
1695+ output_format = " *%evt.num %evt.outputtime %evt.cpu %proc.name (%thread.tid) %evt.dir %evt.type %evt.info" ;
1696+ output_format_plugin = " *%evt.num %evt.datetime.s [%evt.pluginname] %evt.plugininfo" ;
1697+ }
1698+ }
16941699
16951700 // given the CLI options, we finish loading and initializing plugins.
16961701 // if no plugin has been specified as input with -I, we try to
0 commit comments