File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -23,14 +23,23 @@ export const loggerPlugin: Plugin = (proxyServer, options) => {
2323 * ```
2424 */
2525 proxyServer . on ( 'proxyRes' , ( proxyRes : any , req : any , res ) => {
26- const exchange = `[HPM] ${ req . method } ${ req . baseUrl } ${ req . path } -> ${ proxyRes . req . protocol } //${ proxyRes . req . host } ${ proxyRes . req . path } [${ proxyRes . statusCode } ]` ;
26+ // BrowserSync uses req.originalUrl
27+ const originalUrl = req . originalUrl ?? `${ req . baseUrl } ${ req . path } ` ;
28+ const exchange = `[HPM] ${ req . method } ${ originalUrl } -> ${ proxyRes . req . protocol } //${ proxyRes . req . host } ${ proxyRes . req . path } [${ proxyRes . statusCode } ]` ;
2729 logger . info ( exchange ) ;
2830 } ) ;
2931
32+ /**
33+ * When client opens WebSocket connection
34+ */
35+ proxyServer . on ( 'open' , ( socket ) => {
36+ logger . info ( '[HPM] Client connected: %o' , socket . address ( ) ) ;
37+ } ) ;
38+
3039 /**
3140 * When client closes WebSocket connection
3241 */
3342 proxyServer . on ( 'close' , ( req , proxySocket , proxyHead ) => {
34- logger . info ( '[HPM] Client disconnected' ) ;
43+ logger . info ( '[HPM] Client disconnected: %o' , proxySocket . address ( ) ) ;
3544 } ) ;
3645} ;
You can’t perform that action at this time.
0 commit comments