Skip to content

Commit

Permalink
log exception of running an external application
Browse files Browse the repository at this point in the history
  • Loading branch information
jochenkirstaetter committed Oct 30, 2024
1 parent a519169 commit 2c3e38b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Mscc.GenerativeAI/BaseModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ private string RunExternalExe(string filename, string arguments)
}
catch (Exception e)
{
// throw new Exception("OS error while executing " + Format(filename, arguments)+ ": " + e.Message, e);
Logger.LogRunExternalExe("OS error while executing " + Format(filename, arguments)+ ": " + e.Message);
return string.Empty;
}

Expand Down
5 changes: 4 additions & 1 deletion src/Mscc.GenerativeAI/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Feature suggestion: Retry mechanism ([#2](https://github.com/mscraftsman/generative-ai/issues/2))
- Feature suggestion: Add logs with LogLevel using the Standard logging in .NET ([#6](https://github.com/mscraftsman/generative-ai/issues/6))
- implement Automatic Function Call (AFC)

### Changed
### Fixed

## 1.8.1

### Added

- add logs with LogLevel using the Standard logging in .NET ([#6](https://github.com/mscraftsman/generative-ai/issues/6)) - thanks @doggy8088

### Changed

- improve regarding XMLdoc, typos, and non-nullable properties
Expand Down
10 changes: 10 additions & 0 deletions src/Mscc.GenerativeAI/Logging/GenerativeModelLogMessages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,15 @@ public static partial void LogGenerativeModelInvokingRequest(
string methodName,
string url,
string payload);

/// <summary>
/// Logs <see cref="BaseModel"/> when exception thrown to run an external application.
/// </summary>
/// <param name="logger">Optional. Logger instance used for logging</param>
/// <param name="message">Message of <see cref="System.Exception"/> to log.</param>
[LoggerMessage(EventId = 0, Level = LogLevel.Warning, Message = "{Message}")]
public static partial void LogRunExternalExe(
this ILogger logger,
string message);
}
}

0 comments on commit 2c3e38b

Please sign in to comment.