-
Notifications
You must be signed in to change notification settings - Fork 53
CHANGE @W-17701097@ Logfile now communicated at start. #1745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| # common.streaming-logs-to | ||
|
|
||
| Streaming logs in real time to: | ||
|
|
||
| # common.summary-header | ||
|
|
||
| Summary | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ export class RulesAction { | |
| public async execute(input: RulesInput): Promise<void> { | ||
| const config: CodeAnalyzerConfig = this.dependencies.configFactory.create(input['config-file']); | ||
| const logWriter: LogFileWriter = await LogFileWriter.fromConfig(config); | ||
| this.dependencies.actionSummaryViewer.viewPreExecutionSummary(logWriter.getLogDestination()); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the functional change to this Action. I added it as early in the method as I could (i.e., immediately after the log file writer is instantiated) to minimize the possibility of it being preempted by an error. |
||
| // We always add a Logger Listener to the appropriate listeners list, because we should Always Be Logging. | ||
| this.dependencies.logEventListeners.push(new LogEventLogger(logWriter)); | ||
| const core: CodeAnalyzer = new CodeAnalyzer(config); | ||
|
|
@@ -60,7 +61,7 @@ export class RulesAction { | |
| const rules: Rule[] = core.getEngineNames().flatMap(name => ruleSelection.getRulesFor(name)); | ||
|
|
||
| this.dependencies.viewer.view(rules); | ||
| this.dependencies.actionSummaryViewer.view(ruleSelection, logWriter.getLogDestination()); | ||
| this.dependencies.actionSummaryViewer.viewPostExecutionSummary(ruleSelection, logWriter.getLogDestination()); | ||
| } | ||
|
|
||
| public static createAction(dependencies: RulesDependencies): RulesAction { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,6 +50,7 @@ export class RunAction { | |
| public async execute(input: RunInput): Promise<void> { | ||
| const config: CodeAnalyzerConfig = this.dependencies.configFactory.create(input['config-file']); | ||
| const logWriter: LogFileWriter = await LogFileWriter.fromConfig(config); | ||
| this.dependencies.actionSummaryViewer.viewPreExecutionSummary(logWriter.getLogDestination()); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the functional change to this Action. I added it as early in the method as I could (i.e., immediately after the log file writer is instantiated) to minimize the possibility of it being preempted by an error. |
||
| // We always add a Logger Listener to the appropriate listeners list, because we should Always Be Logging. | ||
| this.dependencies.logEventListeners.push(new LogEventLogger(logWriter)); | ||
| const core: CodeAnalyzer = new CodeAnalyzer(config); | ||
|
|
@@ -80,7 +81,7 @@ export class RunAction { | |
| this.dependencies.logEventListeners.forEach(listener => listener.stopListening()); | ||
| this.dependencies.writer.write(results); | ||
| this.dependencies.resultsViewer.view(results); | ||
| this.dependencies.actionSummaryViewer.view(results, logWriter.getLogDestination(), input['output-file']); | ||
| this.dependencies.actionSummaryViewer.viewPostExecutionSummary(results, logWriter.getLogDestination(), input['output-file']); | ||
|
|
||
| const thresholdValue = input['severity-threshold']; | ||
| if (thresholdValue) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,15 @@ abstract class AbstractActionSummaryViewer { | |
| this.display = display; | ||
| } | ||
|
|
||
| public viewPreExecutionSummary(logFile: string): void { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| // Start with separator to cleanly break from anything that's already been logged. | ||
| this.displayLineSeparator(); | ||
| this.display.displayLog(getMessage(BundleName.ActionSummaryViewer, 'common.streaming-logs-to')); | ||
| this.display.displayLog(indent(logFile)); | ||
| // End with a separator to cleanly break with anything that comes next. | ||
| this.displayLineSeparator(); | ||
| } | ||
|
|
||
| protected displaySummaryHeader(): void { | ||
| this.display.displayLog(toStyledHeader(getMessage(BundleName.ActionSummaryViewer, 'common.summary-header'))); | ||
| } | ||
|
|
@@ -29,7 +38,9 @@ export class ConfigActionSummaryViewer extends AbstractActionSummaryViewer { | |
| super(display); | ||
| } | ||
|
|
||
| public view(logFile: string, outfile?: string): void { | ||
| public viewPostExecutionSummary(logFile: string, outfile?: string): void { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The concrete summary viewers' |
||
| // Start with separator to cleanly break from anything that's already been logged. | ||
| this.displayLineSeparator(); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was missing the leading newline that all the other summary viewers have, so I went ahead and added it. |
||
| this.displaySummaryHeader(); | ||
| this.displayLineSeparator(); | ||
|
|
||
|
|
@@ -52,7 +63,7 @@ export class RulesActionSummaryViewer extends AbstractActionSummaryViewer { | |
| super(display); | ||
| } | ||
|
|
||
| public view(ruleSelection: RuleSelection, logFile: string): void { | ||
| public viewPostExecutionSummary(ruleSelection: RuleSelection, logFile: string): void { | ||
| // Start with separator to cleanly break from anything that's already been logged. | ||
| this.displayLineSeparator(); | ||
| this.displaySummaryHeader(); | ||
|
|
@@ -82,7 +93,7 @@ export class RunActionSummaryViewer extends AbstractActionSummaryViewer { | |
| super(display); | ||
| } | ||
|
|
||
| public view(results: RunResults, logFile: string, outfiles: string[]): void { | ||
| public viewPostExecutionSummary(results: RunResults, logFile: string, outfiles: string[]): void { | ||
| // Start with separator to cleanly break from anything that's already been logged. | ||
| this.displayLineSeparator(); | ||
| this.displaySummaryHeader(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
|
|
||
| === Summary | ||
|
|
||
| Additional log information written to: |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
|
|
||
| === Summary | ||
|
|
||
| Configuration written to: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
|
|
||
| Streaming logs in real time to: |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
|
|
||
| Streaming logs in real time to: |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
|
|
||
| Streaming logs in real time to: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the functional change to this Action. I added it as early in the method as I could (i.e., immediately after the log file writer is instantiated) to minimize the possibility of it being preempted by an error.
If we want, though, we could easily move it further down and use it in the future to log additional information about, for example, the engines that are added. I'm flexible on this.