diff options
| author | Cody Robibero <cody@robibe.ro> | 2021-10-27 19:20:14 -0600 |
|---|---|---|
| committer | Cody Robibero <cody@robibe.ro> | 2021-10-27 19:20:14 -0600 |
| commit | c534c450330759f6595c9601e3fe8b12e6987e69 (patch) | |
| tree | 0650d4290c5fa56a833747a1616e8ac7c04dd877 /MediaBrowser.Controller/ClientEvent | |
| parent | a6357f89abb40deaa84ed0ea52010c098e769e62 (diff) | |
Suggestions from review
Diffstat (limited to 'MediaBrowser.Controller/ClientEvent')
| -rw-r--r-- | MediaBrowser.Controller/ClientEvent/ClientEventLogger.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.Controller/ClientEvent/IClientEventLogger.cs | 7 |
2 files changed, 7 insertions, 6 deletions
diff --git a/MediaBrowser.Controller/ClientEvent/ClientEventLogger.cs b/MediaBrowser.Controller/ClientEvent/ClientEventLogger.cs index bdc1a7eff..61f7adff3 100644 --- a/MediaBrowser.Controller/ClientEvent/ClientEventLogger.cs +++ b/MediaBrowser.Controller/ClientEvent/ClientEventLogger.cs @@ -1,6 +1,7 @@ using System; using System.IO; using System.Threading.Tasks; +using MediaBrowser.Controller.Net; using MediaBrowser.Model.ClientLog; using Microsoft.Extensions.Logging; @@ -43,10 +44,9 @@ namespace MediaBrowser.Controller.ClientEvent } /// <inheritdoc /> - public async Task WriteFileAsync(string fileName, Stream fileContents) + public async Task WriteDocumentAsync(AuthorizationInfo authorizationInfo, Stream fileContents) { - // Force naming convention: upload_YYYYMMDD_$name - fileName = $"upload_{DateTime.UtcNow:yyyyMMdd}_{fileName}"; + var fileName = $"upload_{authorizationInfo.Client}_{authorizationInfo.Version}_{DateTime.UtcNow:yyyyMMddHHmmss}.log"; var logFilePath = Path.Combine(_applicationPaths.LogDirectoryPath, fileName); await using var fileStream = new FileStream(logFilePath, FileMode.CreateNew, FileAccess.Write, FileShare.None); await fileContents.CopyToAsync(fileStream).ConfigureAwait(false); diff --git a/MediaBrowser.Controller/ClientEvent/IClientEventLogger.cs b/MediaBrowser.Controller/ClientEvent/IClientEventLogger.cs index 7cd71a60d..ee8e5806b 100644 --- a/MediaBrowser.Controller/ClientEvent/IClientEventLogger.cs +++ b/MediaBrowser.Controller/ClientEvent/IClientEventLogger.cs @@ -1,5 +1,6 @@ using System.IO; using System.Threading.Tasks; +using MediaBrowser.Controller.Net; using MediaBrowser.Model.ClientLog; namespace MediaBrowser.Controller.ClientEvent @@ -18,9 +19,9 @@ namespace MediaBrowser.Controller.ClientEvent /// <summary> /// Writes a file to the log directory. /// </summary> - /// <param name="fileName">The file name.</param> - /// <param name="fileContents">The file contents.</param> + /// <param name="authorizationInfo">The current authorization info.</param> + /// <param name="fileContents">The file contents to write.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> - Task WriteFileAsync(string fileName, Stream fileContents); + Task WriteDocumentAsync(AuthorizationInfo authorizationInfo, Stream fileContents); } } |
