@@ -10,7 +10,6 @@ namespace Amazon.Lambda.TestTool
1010{
1111 public class TestToolStartup
1212 {
13- private static bool shouldDisableLogs ;
1413
1514 public class RunConfiguration
1615 {
@@ -37,7 +36,7 @@ public static void Startup(string productName, Action<LocalLambdaOptions, bool>
3736 try
3837 {
3938 var commandOptions = CommandLineOptions . Parse ( args ) ;
40- shouldDisableLogs = Utils . ShouldDisableLogs ( commandOptions ) ;
39+ var shouldDisableLogs = Utils . ShouldDisableLogs ( commandOptions ) ;
4140
4241 if ( ! shouldDisableLogs ) Utils . PrintToolTitle ( productName ) ;
4342
@@ -76,7 +75,7 @@ public static void Startup(string productName, Action<LocalLambdaOptions, bool>
7675
7776 if ( commandOptions . NoUI )
7877 {
79- ExecuteWithNoUi ( localLambdaOptions , commandOptions , lambdaAssemblyDirectory , runConfiguration ) ;
78+ ExecuteWithNoUi ( localLambdaOptions , commandOptions , lambdaAssemblyDirectory , runConfiguration , shouldDisableLogs ) ;
8079 }
8180 else
8281 {
@@ -118,16 +117,16 @@ public static void Startup(string productName, Action<LocalLambdaOptions, bool>
118117 }
119118
120119
121- public static void ExecuteWithNoUi ( LocalLambdaOptions localLambdaOptions , CommandLineOptions commandOptions , string lambdaAssemblyDirectory , RunConfiguration runConfiguration )
120+ public static void ExecuteWithNoUi ( LocalLambdaOptions localLambdaOptions , CommandLineOptions commandOptions , string lambdaAssemblyDirectory , RunConfiguration runConfiguration , bool shouldDisableLogs )
122121 {
123122 if ( ! shouldDisableLogs ) runConfiguration . OutputWriter . WriteLine ( "Executing Lambda function without web interface" ) ;
124123 var lambdaProjectDirectory = Utils . FindLambdaProjectDirectory ( lambdaAssemblyDirectory ) ;
125124
126- string configFile = DetermineConfigFile ( commandOptions , lambdaAssemblyDirectory : lambdaAssemblyDirectory , lambdaProjectDirectory : lambdaProjectDirectory ) ;
127- LambdaConfigInfo configInfo = LoadLambdaConfigInfo ( configFile , commandOptions , lambdaAssemblyDirectory : lambdaAssemblyDirectory , lambdaProjectDirectory : lambdaProjectDirectory , runConfiguration ) ;
128- LambdaFunction lambdaFunction = LoadLambdaFunction ( configInfo , localLambdaOptions , commandOptions , lambdaAssemblyDirectory : lambdaAssemblyDirectory , lambdaProjectDirectory : lambdaProjectDirectory , runConfiguration ) ;
125+ string configFile = DetermineConfigFile ( commandOptions , lambdaAssemblyDirectory : lambdaAssemblyDirectory , lambdaProjectDirectory : lambdaProjectDirectory , shouldDisableLogs : shouldDisableLogs ) ;
126+ LambdaConfigInfo configInfo = LoadLambdaConfigInfo ( configFile , commandOptions , lambdaAssemblyDirectory : lambdaAssemblyDirectory , lambdaProjectDirectory : lambdaProjectDirectory , runConfiguration , shouldDisableLogs : shouldDisableLogs ) ;
127+ LambdaFunction lambdaFunction = LoadLambdaFunction ( configInfo , localLambdaOptions , commandOptions , lambdaAssemblyDirectory : lambdaAssemblyDirectory , lambdaProjectDirectory : lambdaProjectDirectory , runConfiguration , shouldDisableLogs : shouldDisableLogs ) ;
129128
130- string payload = DeterminePayload ( localLambdaOptions , commandOptions , lambdaAssemblyDirectory : lambdaAssemblyDirectory , lambdaProjectDirectory : lambdaProjectDirectory , runConfiguration ) ;
129+ string payload = DeterminePayload ( localLambdaOptions , commandOptions , lambdaAssemblyDirectory : lambdaAssemblyDirectory , lambdaProjectDirectory : lambdaProjectDirectory , runConfiguration , shouldDisableLogs : shouldDisableLogs ) ;
131130
132131 var awsProfile = commandOptions . AWSProfile ?? configInfo . AWSProfile ;
133132 if ( ! string . IsNullOrEmpty ( awsProfile ) )
@@ -166,7 +165,7 @@ public static void ExecuteWithNoUi(LocalLambdaOptions localLambdaOptions, Comman
166165 Function = lambdaFunction
167166 } ;
168167
169- ExecuteRequest ( request , localLambdaOptions , runConfiguration ) ;
168+ ExecuteRequest ( request , localLambdaOptions , runConfiguration , shouldDisableLogs ) ;
170169
171170
172171 if ( runConfiguration . Mode == RunConfiguration . RunMode . Normal && commandOptions . PauseExit )
@@ -176,7 +175,7 @@ public static void ExecuteWithNoUi(LocalLambdaOptions localLambdaOptions, Comman
176175 }
177176 }
178177
179- private static string DetermineConfigFile ( CommandLineOptions commandOptions , string lambdaAssemblyDirectory , string lambdaProjectDirectory )
178+ private static string DetermineConfigFile ( CommandLineOptions commandOptions , string lambdaAssemblyDirectory , string lambdaProjectDirectory , bool shouldDisableLogs )
180179 {
181180 string configFile = null ;
182181 if ( string . IsNullOrEmpty ( commandOptions . ConfigFile ) )
@@ -199,7 +198,7 @@ private static string DetermineConfigFile(CommandLineOptions commandOptions, str
199198 return configFile ;
200199 }
201200
202- private static LambdaConfigInfo LoadLambdaConfigInfo ( string configFile , CommandLineOptions commandOptions , string lambdaAssemblyDirectory , string lambdaProjectDirectory , RunConfiguration runConfiguration )
201+ private static LambdaConfigInfo LoadLambdaConfigInfo ( string configFile , CommandLineOptions commandOptions , string lambdaAssemblyDirectory , string lambdaProjectDirectory , RunConfiguration runConfiguration , bool shouldDisableLogs )
203202 {
204203 LambdaConfigInfo configInfo ;
205204 if ( configFile != null )
@@ -226,7 +225,7 @@ private static LambdaConfigInfo LoadLambdaConfigInfo(string configFile, CommandL
226225 return configInfo ;
227226 }
228227
229- private static LambdaFunction LoadLambdaFunction ( LambdaConfigInfo configInfo , LocalLambdaOptions localLambdaOptions , CommandLineOptions commandOptions , string lambdaAssemblyDirectory , string lambdaProjectDirectory , RunConfiguration runConfiguration )
228+ private static LambdaFunction LoadLambdaFunction ( LambdaConfigInfo configInfo , LocalLambdaOptions localLambdaOptions , CommandLineOptions commandOptions , string lambdaAssemblyDirectory , string lambdaProjectDirectory , RunConfiguration runConfiguration , bool shouldDisableLogs )
230229 {
231230 // If no function handler was explicitly set and there is only one function defined in the config file then assume the user wants to debug that function.
232231 var functionHandler = commandOptions . FunctionHandler ;
@@ -264,7 +263,7 @@ private static LambdaFunction LoadLambdaFunction(LambdaConfigInfo configInfo, Lo
264263 return lambdaFunction ;
265264 }
266265
267- private static string DeterminePayload ( LocalLambdaOptions localLambdaOptions , CommandLineOptions commandOptions , string lambdaAssemblyDirectory , string lambdaProjectDirectory , RunConfiguration runConfiguration )
266+ private static string DeterminePayload ( LocalLambdaOptions localLambdaOptions , CommandLineOptions commandOptions , string lambdaAssemblyDirectory , string lambdaProjectDirectory , RunConfiguration runConfiguration , bool shouldDisableLogs )
268267 {
269268 var payload = commandOptions . Payload ;
270269
@@ -346,7 +345,7 @@ private static string DeterminePayload(LocalLambdaOptions localLambdaOptions, Co
346345 return payload ;
347346 }
348347
349- private static void ExecuteRequest ( ExecutionRequest request , LocalLambdaOptions localLambdaOptions , RunConfiguration runConfiguration )
348+ private static void ExecuteRequest ( ExecutionRequest request , LocalLambdaOptions localLambdaOptions , RunConfiguration runConfiguration , bool shouldDisableLogs )
350349 {
351350 try
352351 {
0 commit comments