@@ -53,7 +53,6 @@ pub struct LogArgs<T: AsRef<Path>> {
5353pub struct LogGuard {
5454 _file_guard : Option < WorkerGuard > ,
5555 _stdout_guard : Option < WorkerGuard > ,
56- _mcp_file_guard : Option < WorkerGuard > ,
5756}
5857
5958/// Initialize our application level logging using the given LogArgs.
@@ -66,7 +65,6 @@ pub fn initialize_logging<T: AsRef<Path>>(args: LogArgs<T>) -> Result<LogGuard,
6665 let filter_layer = create_filter_layer ( ) ;
6766 let ( reloadable_filter_layer, reloadable_handle) = tracing_subscriber:: reload:: Layer :: new ( filter_layer) ;
6867 ENV_FILTER_RELOADABLE_HANDLE . lock ( ) . unwrap ( ) . replace ( reloadable_handle) ;
69- let mut mcp_path = None ;
7068
7169 // First we construct the file logging layer if a file name was provided.
7270 let ( file_layer, _file_guard) = match args. log_file_path {
@@ -75,9 +73,6 @@ pub fn initialize_logging<T: AsRef<Path>>(args: LogArgs<T>) -> Result<LogGuard,
7573
7674 // Make the log path parent directory if it doesn't exist.
7775 if let Some ( parent) = log_path. parent ( ) {
78- if log_path. ends_with ( "chat.log" ) {
79- mcp_path = Some ( parent. to_path_buf ( ) ) ;
80- }
8176 std:: fs:: create_dir_all ( parent) ?;
8277 }
8378
@@ -124,63 +119,20 @@ pub fn initialize_logging<T: AsRef<Path>>(args: LogArgs<T>) -> Result<LogGuard,
124119 ( None , None )
125120 } ;
126121
127- // Set up for mcp servers layer if we are in chat
128- let ( mcp_server_layer, _mcp_file_guard) = if let Some ( parent) = mcp_path {
129- let mcp_path = parent. join ( "mcp.log" ) ;
130- if args. delete_old_log_file {
131- std:: fs:: remove_file ( & mcp_path) . ok ( ) ;
132- } else if mcp_path. exists ( ) && std:: fs:: metadata ( & mcp_path) ?. len ( ) > MAX_FILE_SIZE {
133- std:: fs:: remove_file ( & mcp_path) ?;
134- }
135- let file = if args. delete_old_log_file {
136- File :: create ( & mcp_path) ?
137- } else {
138- File :: options ( ) . append ( true ) . create ( true ) . open ( & mcp_path) ?
139- } ;
140- #[ cfg( unix) ]
141- {
142- use std:: os:: unix:: fs:: PermissionsExt ;
143- if let Ok ( metadata) = file. metadata ( ) {
144- let mut permissions = metadata. permissions ( ) ;
145- permissions. set_mode ( 0o600 ) ;
146- file. set_permissions ( permissions) . ok ( ) ;
147- }
148- }
149- let ( non_blocking, guard) = tracing_appender:: non_blocking ( file) ;
150- let file_layer = fmt:: layer ( )
151- . with_line_number ( true )
152- . with_writer ( non_blocking)
153- . with_filter ( EnvFilter :: new ( "mcp=trace" ) ) ;
154- ( Some ( file_layer) , Some ( guard) )
155- } else {
156- ( None , None )
157- } ;
158-
159122 if let Some ( level) = args. log_level {
160123 set_log_level ( level) ?;
161124 }
162125
163126 // Finally, initialize our logging
164- let subscriber = tracing_subscriber:: registry ( )
127+ tracing_subscriber:: registry ( )
165128 . with ( reloadable_filter_layer)
166129 . with ( file_layer)
167- . with ( stdout_layer) ;
168-
169- if let Some ( mcp_server_layer) = mcp_server_layer {
170- subscriber. with ( mcp_server_layer) . init ( ) ;
171- return Ok ( LogGuard {
172- _file_guard,
173- _stdout_guard,
174- _mcp_file_guard,
175- } ) ;
176- }
177-
178- subscriber. init ( ) ;
130+ . with ( stdout_layer)
131+ . init ( ) ;
179132
180133 Ok ( LogGuard {
181134 _file_guard,
182135 _stdout_guard,
183- _mcp_file_guard,
184136 } )
185137}
186138
0 commit comments