33'use strict' ;
44import * as fastDeepEqual from 'fast-deep-equal' ;
55import * as Redux from 'redux' ;
6- import { logger } from 'redux-logger' ;
6+ import { createLogger } from 'redux-logger' ;
77
88import { Identifiers } from '../../../client/datascience/constants' ;
99import { InteractiveWindowMessages } from '../../../client/datascience/interactive-common/interactiveWindowTypes' ;
@@ -14,7 +14,7 @@ import { PostOffice } from '../../react-common/postOffice';
1414import { combineReducers , createQueueableActionMiddleware , QueuableAction } from '../../react-common/reduxUtils' ;
1515import { computeEditorOptions , loadDefaultSettings } from '../../react-common/settingsReactSide' ;
1616import { createEditableCellVM , generateTestState } from '../mainState' ;
17- import { AllowedMessages , createPostableAction , generatePostOfficeSendReducer } from './postOffice' ;
17+ import { AllowedMessages , createPostableAction , generatePostOfficeSendReducer , IncomingMessageActions } from './postOffice' ;
1818
1919function generateDefaultState ( skipDefault : boolean , testMode : boolean , baseTheme : string , editable : boolean ) : IMainState {
2020 const defaultSettings = loadDefaultSettings ( ) ;
@@ -143,6 +143,41 @@ function createMiddleWare(testMode: boolean): Redux.Middleware<{}, IStore>[] {
143143 const testMiddleware = testMode ? createTestMiddleware ( ) : undefined ;
144144
145145 // Create the logger if we're not in production mode or we're forcing logging
146+ const reduceLogMessage = '<payload too large to displayed in logs (at least on CI)>' ;
147+ const actionsWithLargePayload = [ IncomingMessageActions . LOADONIGASMASSEMBLYRESPONSE , IncomingMessageActions . GETCSSRESPONSE , IncomingMessageActions . LOADTMLANGUAGERESPONSE ] ;
148+ const logger = createLogger ( {
149+ // tslint:disable-next-line: no-any
150+ stateTransformer : ( state : any ) => {
151+ if ( ! state || typeof state !== 'object' ) {
152+ return state ;
153+ }
154+ // tslint:disable-next-line: no-any
155+ const rootState = { ...state } as any ;
156+ if ( 'main' in rootState && typeof rootState . main === 'object' ) {
157+ // tslint:disable-next-line: no-any
158+ const main = rootState . main = { ...rootState . main } as any as Partial < IMainState > ;
159+ main . rootCss = reduceLogMessage ;
160+ main . rootStyle = reduceLogMessage ;
161+ // tslint:disable-next-line: no-any
162+ main . editorOptions = reduceLogMessage as any ;
163+ // tslint:disable-next-line: no-any
164+ main . settings = reduceLogMessage as any ;
165+ }
166+ rootState . monaco = reduceLogMessage ;
167+
168+ return rootState ;
169+ } ,
170+ // tslint:disable-next-line: no-any
171+ actionTransformer : ( action : any ) => {
172+ if ( ! action ) {
173+ return action ;
174+ }
175+ if ( actionsWithLargePayload . indexOf ( action . type ) >= 0 ) {
176+ return { ...action , payload : reduceLogMessage } ;
177+ }
178+ return action ;
179+ }
180+ } ) ;
146181 const loggerMiddleware = process . env . VSC_PYTHON_FORCE_LOGGING !== undefined || ( process . env . NODE_ENV !== 'production' && ! testMode )
147182 ? logger : undefined ;
148183
0 commit comments