Skip to content
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

fix json log consistency #452

Merged
merged 1 commit into from
Nov 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Runner.Client/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2105,7 +2105,7 @@ await Task.WhenAny(Task.Run(() => {

}
if(parameters.Json) {
Console.WriteLine(JsonConvert.SerializeObject(new { dryrun = false, workflowName = rec.WorkflowName, job = rec.TimeLine[0].Name, jobID = rec.TimeLine[0].RefName, level = "info", matrix = new {}, jobResult = ActionResultStatusConverter.FromPipelines(ev.Result).ToString().ToLower(), msg = $"Job Completed with Status: {ev.Result.ToString()}", time = System.DateTime.Now }));
Console.WriteLine(JsonConvert.SerializeObject(new { dryrun = false, workflowName = rec.WorkflowName, job = rec.TimeLine[0].Name, jobID = rec.TimeLine[0].RefName, level = "info", matrix = JArray.Parse(jobs.FirstOrDefault(j => j.JobId == rec.TimeLine[0].Id)?.Matrix ?? "[{}]").LastOrDefault() ?? new JObject(), jobResult = ActionResultStatusConverter.FromPipelines(ev.Result).ToString().ToLower(), msg = $"Job Completed with Status: {ev.Result.ToString()}", time = System.DateTime.Now }));
} else {
WriteLogLine((int)rec.Color, $"{(rec.WorkflowName != null ? $"{rec.WorkflowName} / " : "")}{rec.TimeLine[0].Name}", $"Job Completed with Status: {ev.Result.ToString()}");
}
Expand Down Expand Up @@ -2148,7 +2148,7 @@ await Task.WhenAny(Task.Run(() => {
continue;
}
if(parameters.Json) {
Console.WriteLine(JsonConvert.SerializeObject(new { dryrun = false, workflowName = rec.WorkflowName, job = rec.TimeLine[0].Name, jobID = rec.TimeLine[0].RefName, level = "info", matrix = JArray.Parse(jobs.FirstOrDefault(j => j.JobId == rec.TimeLine[0].Id)?.Matrix ?? "[{}]").LastOrDefault() ?? new JObject(), stepResult = ActionResultStatusConverter.FromPipelines(record.Result.Value).ToString().ToLower(), msg = $"{record.Result.Value.ToString()}: {record.Name}", stage = "Main", step = rec.TimeLine.Find(r => r.Id == e.record.StepId)?.Name, stepID = new [] { rec.RecordId.ToString() }, time = System.DateTime.Now }));
Console.WriteLine(JsonConvert.SerializeObject(new { dryrun = false, workflowName = rec.WorkflowName, job = rec.TimeLine[0].Name, jobID = rec.TimeLine[0].RefName, level = "info", matrix = JArray.Parse(jobs.FirstOrDefault(j => j.JobId == rec.TimeLine[0].Id)?.Matrix ?? "[{}]").LastOrDefault() ?? new JObject(), stepResult = ActionResultStatusConverter.FromPipelines(record.Result.Value).ToString().ToLower(), msg = $"{record.Result.Value.ToString()}: {record.Name}", stage = "Main", step = record.Name, stepID = new [] { record.Id.ToString() }, time = System.DateTime.Now }));
} else {
WriteLogLine((int)rec.Color, $"{(rec.WorkflowName != null ? $"{rec.WorkflowName} / " : "")}{rec.TimeLine[0].Name}", $"{record.Result.Value.ToString()}: {record.Name}");
}
Expand Down Expand Up @@ -2199,7 +2199,7 @@ await Task.WhenAny(Task.Run(() => {
}
var rec = timelineRecords[e.timelineId];
if(parameters.Json) {
Console.WriteLine(JsonConvert.SerializeObject(new { dryrun = false, workflowName = rec.WorkflowName, job = rec.TimeLine[0].Name, jobID = rec.TimeLine[0].RefName, level = "info", matrix = JArray.Parse(jobs.FirstOrDefault(j => j.JobId == rec.TimeLine[0].Id)?.Matrix ?? "[{}]").LastOrDefault() ?? new JObject(), stepResult = ActionResultStatusConverter.FromPipelines(record.Result.Value).ToString().ToLower(), msg = $"{record.Result.Value.ToString()}: {record.Name}", stage = "Main", step = rec.TimeLine.Find(r => r.Id == e2.record.StepId)?.Name, stepID = new [] { rec.RecordId.ToString() }, time = System.DateTime.Now }));
Console.WriteLine(JsonConvert.SerializeObject(new { dryrun = false, workflowName = rec.WorkflowName, job = rec.TimeLine[0].Name, jobID = rec.TimeLine[0].RefName, level = "info", matrix = JArray.Parse(jobs.FirstOrDefault(j => j.JobId == rec.TimeLine[0].Id)?.Matrix ?? "[{}]").LastOrDefault() ?? new JObject(), stepResult = ActionResultStatusConverter.FromPipelines(record.Result.Value).ToString().ToLower(), msg = $"{record.Result.Value.ToString()}: {record.Name}", stage = "Main", step = record.Name, stepID = new [] { record.Id.ToString() }, time = System.DateTime.Now }));
} else {
WriteLogLine((int)rec.Color, $"{(rec.WorkflowName != null ? $"{rec.WorkflowName} / " : "")}{rec.TimeLine[0].Name}", $"{record.Result.Value.ToString()}: {record.Name}");
}
Expand Down Expand Up @@ -2240,7 +2240,7 @@ await Task.WhenAny(Task.Run(() => {
var rec = timelineRecords[e.timelineId];
rec.RecordId = Guid.Empty;
if(parameters.Json) {
Console.WriteLine(JsonConvert.SerializeObject(new { dryrun = false, workflowName = rec.WorkflowName, job = rec.TimeLine[0].Name, jobID = rec.TimeLine[0].RefName, level = "info", matrix = JArray.Parse(jobs.FirstOrDefault(j => j.JobId == rec.TimeLine[0].Id)?.Matrix ?? "[{}]").LastOrDefault() ?? new JObject(), stepResult = ActionResultStatusConverter.FromPipelines(record.Result.Value).ToString().ToLower(), msg = $"{record.Result.Value.ToString()}: {record.Name}", stage = "Main", step = rec.TimeLine.Find(r => r.Id == rec.RecordId)?.Name, stepID = new [] { rec.RecordId.ToString() }, time = System.DateTime.Now }));
Console.WriteLine(JsonConvert.SerializeObject(new { dryrun = false, workflowName = rec.WorkflowName, job = rec.TimeLine[0].Name, jobID = rec.TimeLine[0].RefName, level = "info", matrix = JArray.Parse(jobs.FirstOrDefault(j => j.JobId == rec.TimeLine[0].Id)?.Matrix ?? "[{}]").LastOrDefault() ?? new JObject(), stepResult = ActionResultStatusConverter.FromPipelines(record.Result.Value).ToString().ToLower(), msg = $"{record.Result.Value.ToString()}: {record.Name}", stage = "Main", step = record.Name, stepID = new [] { record.Id.ToString() }, time = System.DateTime.Now }));
} else {
WriteLogLine((int)rec.Color, $"{(rec.WorkflowName != null ? $"{rec.WorkflowName} / " : "")}{rec.TimeLine[0].Name}", $"{record.Result.Value.ToString()}: {record.Name}");
}
Expand Down
Loading