Skip to content

Commit

Permalink
LINE APIの呼び出し結果をログ出力するように変更。
Browse files Browse the repository at this point in the history
  • Loading branch information
YDKK committed Jul 2, 2023
1 parent 4ba23d5 commit 139ebb1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions SlackLineBridge/Controllers/WebhookController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ private async Task<IActionResult> PushToLine(string host, SlackChannel slackChan
message
}.Concat(urlMessages).ToArray()
};
await client.PostAsync($"message/push", new StringContent(JsonSerializer.Serialize(json), Encoding.UTF8, "application/json"));
var jsonStr = JsonSerializer.Serialize(json);
_logger.LogInformation("Push message to LINE: " + jsonStr);
var result = await client.PostAsync($"message/push", new StringContent(jsonStr, Encoding.UTF8, "application/json"));
_logger.LogInformation($"LINE API result [{result.StatusCode}]: " + await result.Content.ReadAsStringAsync());
}

if (files != null)
Expand Down Expand Up @@ -230,7 +233,8 @@ private async Task<IActionResult> PushToLine(string host, SlackChannel slackChan
};
var jsonStr = JsonSerializer.Serialize(json);
_logger.LogInformation("Push images to LINE: " + jsonStr);
await client.PostAsync($"message/push", new StringContent(jsonStr, Encoding.UTF8, "application/json"));
var result = await client.PostAsync($"message/push", new StringContent(jsonStr, Encoding.UTF8, "application/json"));
_logger.LogInformation($"LINE API result [{result.StatusCode}]: " + await result.Content.ReadAsStringAsync());
}
}
return Ok();
Expand Down

0 comments on commit 139ebb1

Please sign in to comment.