Merge pull request #650 from ONLYOFFICE/feature/logger-Files.Core

Feature/logger files.core
This commit is contained in:
Pavel Bannov 2022-05-20 16:22:16 +03:00 committed by GitHub
commit 19d219ba84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
67 changed files with 1694 additions and 243 deletions

View File

@ -90,7 +90,7 @@ public class ChunkedUploadSessionHelper
{ {
if (f == null) if (f == null)
{ {
_logger.LogError("GetBreadCrumbs {folderId} with null", session.FolderId); _logger.ErrorInUserInfoRequest(session.FolderId.ToString());
return default; return default;
} }

View File

@ -108,7 +108,7 @@ public class EditHistory
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "DeSerialize old scheme exception"); _logger.ErrorDeSerializeOldScheme(ex);
} }
return changes; return changes;

View File

@ -1713,7 +1713,7 @@ public class FileStorageService<T> //: IFileStorageService
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "DocEditor"); _logger.ErrorDocEditor(ex);
throw; throw;
} }
@ -1757,7 +1757,7 @@ public class FileStorageService<T> //: IFileStorageService
//move common thirdparty storage userFrom //move common thirdparty storage userFrom
foreach (var commonProviderInfo in commonProvidersInfo) foreach (var commonProviderInfo in commonProvidersInfo)
{ {
_logger.LogInformation("Reassign provider {providerId} from {fromUser} to {toUser}", commonProviderInfo.ID, userFrom.Id, userTo.Id); _logger.InformationReassignProvider(commonProviderInfo.ID, userFrom.Id, userTo.Id);
await providerDao.UpdateProviderInfoAsync(commonProviderInfo.ID, null, null, FolderType.DEFAULT, userTo.Id); await providerDao.UpdateProviderInfoAsync(commonProviderInfo.ID, null, null, FolderType.DEFAULT, userTo.Id);
} }
} }
@ -1805,7 +1805,7 @@ public class FileStorageService<T> //: IFileStorageService
//delete thirdparty storage //delete thirdparty storage
foreach (var myProviderInfo in providersInfo) foreach (var myProviderInfo in providersInfo)
{ {
_logger.LogInformation("Delete provider {providerId} for {userId}", myProviderInfo.ID, userId); _logger.InformationDeleteProvider(myProviderInfo.ID, userId);
await providerDao.RemoveProviderInfoAsync(myProviderInfo.ID); await providerDao.RemoveProviderInfoAsync(myProviderInfo.ID);
} }
} }
@ -2516,7 +2516,7 @@ public class FileStorageService<T> //: IFileStorageService
} }
catch (Exception e) catch (Exception e)
{ {
_logger.LogError(e, "CreateThumbnails"); _logger.ErrorCreateThumbnails(e);
} }
return fileIds; return fileIds;
@ -2543,7 +2543,7 @@ public class FileStorageService<T> //: IFileStorageService
} }
catch (Exception e) catch (Exception e)
{ {
_logger.LogError(e, "CreateThumbnails"); _logger.ErrorCreateThumbnails(e);
} }
return fileIds; return fileIds;
@ -2601,11 +2601,11 @@ public class FileStorageService<T> //: IFileStorageService
{ {
if (warning) if (warning)
{ {
_logger.LogInformation(error, ""); _logger.Information(error.ToString());
} }
else else
{ {
_logger.LogError(error, "FileStorageService"); _logger.ErrorFileStorageService(error);
} }
return new InvalidOperationException(error.Message, error); return new InvalidOperationException(error.Message, error);

View File

@ -198,7 +198,7 @@ public class FactoryIndexerFile : FactoryIndexer<DbFile>
} }
catch (Exception e) catch (Exception e)
{ {
Logger.LogError(e, "FactoryIndexerFile"); Logger.ErrorFactoryIndexerFile(e);
throw; throw;
} }
} }

View File

@ -144,7 +144,7 @@ public class FactoryIndexerFolder : FactoryIndexer<DbFolder>
} }
catch (Exception e) catch (Exception e)
{ {
Logger.LogError(e, "FactoryIndexerFolder"); Logger.ErrorFactoryIndexerFolder(e);
throw; throw;
} }
} }

View File

@ -69,7 +69,7 @@ internal class GoogleDriveProviderInfo : IProviderInfo
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "GoogleDrive error"); _logger.ErrorGoogleDrive(ex);
return null; return null;
} }

View File

@ -314,7 +314,7 @@ internal class GoogleDriveStorage : IDisposable
throw result.Exception; throw result.Exception;
} }
_logger.LogError(result.Exception, "Error while trying to insert entity. GoogleDrive insert returned an error."); _logger.ErrorWhileTryingToInsertEntity(result.Exception);
} }
return request.ResponseBody; return request.ResponseBody;
@ -345,7 +345,7 @@ internal class GoogleDriveStorage : IDisposable
throw result.Exception; throw result.Exception;
} }
_logger.LogError(result.Exception, "Error while trying to insert entity. GoogleDrive insert returned an error."); _logger.ErrorWhileTryingToInsertEntity(result.Exception);
} }
return request.ResponseBody; return request.ResponseBody;
@ -468,7 +468,7 @@ internal class GoogleDriveStorage : IDisposable
throw result.Exception; throw result.Exception;
} }
_logger.LogError(result.Exception, "Error while trying to insert entity. GoogleDrive save returned an error."); _logger.ErrorWhileTryingToInsertEntity(result.Exception);
} }
return request.ResponseBody; return request.ResponseBody;
@ -489,7 +489,7 @@ internal class GoogleDriveStorage : IDisposable
throw result.Exception; throw result.Exception;
} }
_logger.LogError(result.Exception, "Error while trying to insert entity. GoogleDrive save returned an error."); _logger.ErrorWhileTryingToInsertEntity(result.Exception);
} }
return request.ResponseBody; return request.ResponseBody;

View File

@ -124,7 +124,7 @@ internal class ProviderAccountDao : IProviderDao
} }
catch (Exception e) catch (Exception e)
{ {
_logger.LogError(e, string.Format("GetProvidersInfoInternal: user = {0}", userId)); _logger.ErrorGetProvidersInfoInternalUser(userId, e);
return new List<IProviderInfo>().ToAsyncEnumerable(); return new List<IProviderInfo>().ToAsyncEnumerable();
} }
@ -149,8 +149,7 @@ internal class ProviderAccountDao : IProviderDao
} }
catch (Exception e) catch (Exception e)
{ {
_logger.LogError(e, string.Format("GetProvidersInfoInternal: linkId = {0} , folderType = {1} , user = {2}", _logger.ErrorGetProvidersInfoInternal(linkId, folderType, _securityContext.CurrentAccount.ID, e);
linkId, folderType, _securityContext.CurrentAccount.ID));
return new List<IProviderInfo>().ToAsyncEnumerable(); return new List<IProviderInfo>().ToAsyncEnumerable();
} }
} }
@ -245,7 +244,7 @@ internal class ProviderAccountDao : IProviderDao
} }
catch (Exception e) catch (Exception e)
{ {
_logger.LogError(e, string.Format("UpdateProviderInfo: linkId = {0} , user = {1}", linkId, _securityContext.CurrentAccount.ID)); _logger.ErrorUpdateProviderInfo(linkId, _securityContext.CurrentAccount.ID, e);
throw; throw;
} }

View File

@ -68,7 +68,7 @@ public class SharePointProviderInfo : IProviderInfo
} }
catch (Exception e) catch (Exception e)
{ {
_logger.LogWarning(e, "CheckAccess"); _logger.WarningCheckAccess(e);
return Task.FromResult(false); return Task.FromResult(false);
} }

View File

@ -215,7 +215,7 @@ internal abstract class SharpBoxDaoBase : ThirdPartyProviderDao<SharpBoxProvider
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "Sharpbox makeId error"); _logger.ErrorSharpboxMakeId(ex);
} }
} }
else if (entry != null) else if (entry != null)

View File

@ -86,7 +86,7 @@ internal class SharpBoxProviderInfo : IProviderInfo
} }
catch (SharpBoxException ex) catch (SharpBoxException ex)
{ {
Logger.LogError(ex, "Sharpbox CheckAccess error"); Logger.ErrorSharpboxCheckAccess(ex);
return Task.FromResult(false); return Task.FromResult(false);
} }

View File

@ -41,7 +41,7 @@ global using System.Text;
global using System.Text.Json; global using System.Text.Json;
global using System.Text.Json.Serialization; global using System.Text.Json.Serialization;
global using System.Text.RegularExpressions; global using System.Text.RegularExpressions;
global using System.Web; global using System.Web;
global using System.Xml; global using System.Xml;
global using AppLimit.CloudComputing.SharpBox; global using AppLimit.CloudComputing.SharpBox;
@ -54,6 +54,7 @@ global using ASC.Api.Core;
global using ASC.Api.Utils; global using ASC.Api.Utils;
global using ASC.Common; global using ASC.Common;
global using ASC.Common.Caching; global using ASC.Common.Caching;
global using ASC.Common.Log;
global using ASC.Common.Mapping; global using ASC.Common.Mapping;
global using ASC.Common.Security.Authentication; global using ASC.Common.Security.Authentication;
global using ASC.Common.Security.Authorizing; global using ASC.Common.Security.Authorizing;
@ -85,6 +86,7 @@ global using ASC.Files.Core.ApiModels.ResponseDto;
global using ASC.Files.Core.Core.Entries; global using ASC.Files.Core.Core.Entries;
global using ASC.Files.Core.Data; global using ASC.Files.Core.Data;
global using ASC.Files.Core.EF; global using ASC.Files.Core.EF;
global using ASC.Files.Core.Log;
global using ASC.Files.Core.Mapping; global using ASC.Files.Core.Mapping;
global using ASC.Files.Core.Resources; global using ASC.Files.Core.Resources;
global using ASC.Files.Core.Security; global using ASC.Files.Core.Security;
@ -205,6 +207,7 @@ global using FileType = ASC.Web.Core.Files.FileType;
global using Token = ASC.Web.Files.ThirdPartyApp.Token; global using Token = ASC.Web.Files.ThirdPartyApp.Token;
global using FileShareLink = ASC.Web.Files.Utils.FileShareLink; global using FileShareLink = ASC.Web.Files.Utils.FileShareLink;
global using ModelSnapshot = Microsoft.EntityFrameworkCore.Infrastructure.ModelSnapshot; global using ModelSnapshot = Microsoft.EntityFrameworkCore.Infrastructure.ModelSnapshot;
global using LogLevel = Microsoft.Extensions.Logging.LogLevel;
global using ContentType = System.Net.Mime.ContentType; global using ContentType = System.Net.Mime.ContentType;
global using JsonSerializer = System.Text.Json.JsonSerializer; global using JsonSerializer = System.Text.Json.JsonSerializer;
global using JsonTokenType = System.Text.Json.JsonTokenType; global using JsonTokenType = System.Text.Json.JsonTokenType;

View File

@ -74,7 +74,7 @@ public class DocuSignToken
{ {
try try
{ {
Logger.LogInformation("DocuSign refresh token for user {userId}", _authContext.CurrentAccount.ID); Logger.InformationDocuSignRefreshToken(_authContext.CurrentAccount.ID);
var refreshed = _consumerFactory.Get<DocuSignLoginProvider>().RefreshToken(token.RefreshToken); var refreshed = _consumerFactory.Get<DocuSignLoginProvider>().RefreshToken(token.RefreshToken);
@ -90,7 +90,7 @@ public class DocuSignToken
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.LogError(ex, ("DocuSign refresh token for user " + _authContext.CurrentAccount.ID)); Logger.ErrorDocuSignRefreshToken(_authContext.CurrentAccount.ID, ex);
} }
} }
@ -198,7 +198,7 @@ public class DocuSignHelper
var userInfoString = _requestHelper.PerformRequest(_consumerFactory.Get<DocuSignLoginProvider>().DocuSignHost + "/oauth/userinfo", var userInfoString = _requestHelper.PerformRequest(_consumerFactory.Get<DocuSignLoginProvider>().DocuSignHost + "/oauth/userinfo",
headers: new Dictionary<string, string> { { "Authorization", "Bearer " + _docuSignToken.GetRefreshedToken(token) } }); headers: new Dictionary<string, string> { { "Authorization", "Bearer " + _docuSignToken.GetRefreshedToken(token) } });
Logger.LogDebug("DocuSing userInfo: {userInfo}", userInfoString); Logger.DebugDocuSingUserInfo(userInfoString);
var userInfo = (DocuSignUserInfo)JsonConvert.DeserializeObject(userInfoString, typeof(DocuSignUserInfo)); var userInfo = (DocuSignUserInfo)JsonConvert.DeserializeObject(userInfoString, typeof(DocuSignUserInfo));
@ -306,7 +306,7 @@ public class DocuSignHelper
Url = _baseCommonLinkUtility.GetFullAbsolutePath(DocuSignHandlerService.Path(_filesLinkUtility) + "?" + FilesLinkUtility.Action + "=webhook"), Url = _baseCommonLinkUtility.GetFullAbsolutePath(DocuSignHandlerService.Path(_filesLinkUtility) + "?" + FilesLinkUtility.Action + "=webhook"),
}; };
Logger.LogDebug("DocuSign hook url: {url}", eventNotification.Url); Logger.DebugDocuSingHookUrl(eventNotification.Url);
var signers = new List<Signer>(); var signers = new List<Signer>();
docuSignData.Users.ForEach(uid => docuSignData.Users.ForEach(uid =>
@ -323,7 +323,7 @@ public class DocuSignHelper
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.LogError(ex, "Signer is undefined"); Logger.ErrorSignerIsUndefined(ex);
} }
}); });
@ -350,14 +350,14 @@ public class DocuSignHelper
var envelopesApi = new EnvelopesApi(configuration); var envelopesApi = new EnvelopesApi(configuration);
var envelopeSummary = envelopesApi.CreateEnvelope(accountId, envelopeDefinition); var envelopeSummary = envelopesApi.CreateEnvelope(accountId, envelopeDefinition);
Logger.LogDebug("DocuSign createdEnvelope: {envelopeId}", envelopeSummary.EnvelopeId); Logger.DebugDocuSingCreatedEnvelope(envelopeSummary.EnvelopeId);
var envelopeId = envelopeSummary.EnvelopeId; var envelopeId = envelopeSummary.EnvelopeId;
var url = envelopesApi.CreateSenderView(accountId, envelopeId, new ReturnUrlRequest var url = envelopesApi.CreateSenderView(accountId, envelopeId, new ReturnUrlRequest
{ {
ReturnUrl = _baseCommonLinkUtility.GetFullAbsolutePath(DocuSignHandlerService.Path(_filesLinkUtility) + "?" + FilesLinkUtility.Action + "=redirect") ReturnUrl = _baseCommonLinkUtility.GetFullAbsolutePath(DocuSignHandlerService.Path(_filesLinkUtility) + "?" + FilesLinkUtility.Action + "=redirect")
}); });
Logger.LogDebug("DocuSign senderView: {url}", url.Url); Logger.DebugDocuSingSenderView(url.Url);
return url.Url; return url.Url;
} }
@ -400,7 +400,7 @@ public class DocuSignHelper
file.Title = FileUtility.ReplaceFileExtension(documentName, ".pdf"); file.Title = FileUtility.ReplaceFileExtension(documentName, ".pdf");
var envelopesApi = new EnvelopesApi(configuration); var envelopesApi = new EnvelopesApi(configuration);
Logger.LogInformation("DocuSign webhook get stream: {documentId}", documentId); Logger.InformationDocuSignWebhookGetStream(documentId);
using (var stream = await envelopesApi.GetDocumentAsync(account.AccountId, envelopeId, documentId)) using (var stream = await envelopesApi.GetDocumentAsync(account.AccountId, envelopeId, documentId))
{ {
file.ContentLength = stream.Length; file.ContentLength = stream.Length;

View File

@ -85,7 +85,7 @@ public class FilesMessageService
{ {
if (headers == null) if (headers == null)
{ {
_logger.LogDebug("Empty Request Headers for \"{action}\" type of event", action); _logger.DebugEmptyRequestHeaders(action);
return; return;
} }
@ -103,7 +103,7 @@ public class FilesMessageService
if (_httpContextAccessor == null) if (_httpContextAccessor == null)
{ {
_logger.LogDebug("Empty Http Request for \"{action}\" type of event", action); _logger.DebugEmptyHttpRequest(action);
return; return;
} }

View File

@ -62,13 +62,13 @@ public class GlobalNotify
} }
catch (Exception e) catch (Exception e)
{ {
Logger.LogCritical(e, "ClearCache action"); Logger.CriticalClearCacheAction(e);
} }
}, CacheNotifyAction.Any); }, CacheNotifyAction.Any);
} }
catch (Exception e) catch (Exception e)
{ {
Logger.LogCritical(e, "ClearCache subscribe"); Logger.CriticalClearCacheSubscribe(e);
} }
} }
} }
@ -612,7 +612,7 @@ public class GlobalFolder
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "GetFolderIdAndProccessFirstVisit"); _logger.ErrorGetFolderIdAndProccessFirstVisit(ex);
} }
} }
} }
@ -676,7 +676,7 @@ public class GlobalFolder
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "SaveFile"); _logger.ErrorSaveFile(ex);
} }
} }

View File

@ -99,7 +99,7 @@ public class WordpressHelper
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.LogError(ex, "Get Wordpress info about me "); Logger.ErrorGetWordpressInfo(ex);
return string.Empty; return string.Empty;
} }
@ -117,7 +117,7 @@ public class WordpressHelper
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.LogError(ex, "Create Wordpress post "); Logger.ErrorCreateWordpressPost(ex);
return false; return false;
} }

View File

@ -160,12 +160,12 @@ public class ChunkedUploaderHandlerService
} }
catch (FileNotFoundException error) catch (FileNotFoundException error)
{ {
_logger.LogError(error, "ChunkedUploaderHandlerService"); _logger.ErrorChunkedUploaderHandlerService(error);
await WriteError(context, FilesCommonResource.ErrorMassage_FileNotFound); await WriteError(context, FilesCommonResource.ErrorMassage_FileNotFound);
} }
catch (Exception error) catch (Exception error)
{ {
_logger.LogError(error, "ChunkedUploaderHandlerService"); _logger.ErrorChunkedUploaderHandlerService(error);
await WriteError(context, error.Message); await WriteError(context, error.Message);
} }
} }

View File

@ -209,7 +209,7 @@ public class FileHandlerService
if (!await store.IsFileAsync(FileConstant.StorageDomainTmp, path)) if (!await store.IsFileAsync(FileConstant.StorageDomainTmp, path))
{ {
_logger.LogError("BulkDownload file error. File is not exist on storage. UserId: {userId}.", _authContext.CurrentAccount.ID); _logger.ErrorBulkDownloadFile(_authContext.CurrentAccount.ID);
context.Response.StatusCode = (int)HttpStatusCode.NotFound; context.Response.StatusCode = (int)HttpStatusCode.NotFound;
return; return;
} }
@ -251,7 +251,7 @@ public class FileHandlerService
} }
catch (Exception e) catch (Exception e)
{ {
_logger.LogError(e, "BulkDownloadFile failed for user {0} with error: ", _securityContext.CurrentAccount.ID); _logger.ErrorBulkDownloadFileFailed(_securityContext.CurrentAccount.ID, e);
throw new HttpException((int)HttpStatusCode.BadRequest, e.Message); throw new HttpException((int)HttpStatusCode.BadRequest, e.Message);
} }
} }
@ -308,7 +308,7 @@ public class FileHandlerService
if (!await fileDao.IsExistOnStorageAsync(file)) if (!await fileDao.IsExistOnStorageAsync(file))
{ {
_logger.LogError("Download file error. File is not exist on storage. File id: {fileId}.", file.Id); _logger.ErrorDownloadFile2(file.Id.ToString());
context.Response.StatusCode = (int)HttpStatusCode.NotFound; context.Response.StatusCode = (int)HttpStatusCode.NotFound;
return; return;
@ -364,7 +364,7 @@ public class FileHandlerService
{ {
fileStream = await fileDao.GetFileStreamAsync(file); fileStream = await fileDao.GetFileStreamAsync(file);
_logger.LogInformation("Converting {fileTitle} (fileId: {fileId}) to mp4", file.Title, file.Id); _logger.InformationConvertingToMp4(file.Title, file.Id.ToString());
var stream = await _fFmpegService.Convert(fileStream, ext); var stream = await _fFmpegService.Convert(fileStream, ext);
await store.SaveAsync(string.Empty, mp4Path, stream, mp4Name); await store.SaveAsync(string.Empty, mp4Path, stream, mp4Name);
} }
@ -435,11 +435,11 @@ public class FileHandlerService
} }
catch (ThreadAbortException tae) catch (ThreadAbortException tae)
{ {
_logger.LogError(tae, "DownloadFile"); _logger.ErrorDownloadFile(tae);
} }
catch (HttpException e) catch (HttpException e)
{ {
_logger.LogError(e, "DownloadFile"); _logger.ErrorDownloadFile(e);
throw new HttpException((int)HttpStatusCode.BadRequest, e.Message); throw new HttpException((int)HttpStatusCode.BadRequest, e.Message);
} }
finally finally
@ -460,13 +460,13 @@ public class FileHandlerService
} }
catch (HttpException ex) catch (HttpException ex)
{ {
_logger.LogError(ex, "DownloadFile"); _logger.ErrorDownloadFile(ex);
} }
} }
} }
catch (ThreadAbortException tae) catch (ThreadAbortException tae)
{ {
_logger.LogError(tae, "DownloadFile"); _logger.ErrorDownloadFile(tae);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -477,7 +477,7 @@ public class FileHandlerService
// Get the line number from the stack frame // Get the line number from the stack frame
var line = frame.GetFileLineNumber(); var line = frame.GetFileLineNumber();
_logger.LogError(ex, "Url: {0} IsClientConnected:{1}, line number:{2} frame:{3}", context.Request.Url(), !context.RequestAborted.IsCancellationRequested, line, frame); _logger.ErrorUrl(context.Request.Url(), !context.RequestAborted.IsCancellationRequested, line, frame, ex);
if (!flushed && !context.RequestAborted.IsCancellationRequested) if (!flushed && !context.RequestAborted.IsCancellationRequested)
{ {
context.Response.StatusCode = 400; context.Response.StatusCode = 400;
@ -518,7 +518,7 @@ public class FileHandlerService
throw new HttpException(HttpStatusCode.RequestedRangeNotSatisfiable); throw new HttpException(HttpStatusCode.RequestedRangeNotSatisfiable);
} }
_logger.LogInformation("Starting file download (chunk {offset}-{endOffset})", offset, endOffset); _logger.InformationStartingFileDownLoad(offset, endOffset);
if (length < fullLength) if (length < fullLength)
{ {
context.Response.StatusCode = (int)HttpStatusCode.PartialContent; context.Response.StatusCode = (int)HttpStatusCode.PartialContent;
@ -588,7 +588,7 @@ public class FileHandlerService
{ {
var exc = new HttpException((int)HttpStatusCode.Forbidden, FilesCommonResource.ErrorMassage_SecurityException); var exc = new HttpException((int)HttpStatusCode.Forbidden, FilesCommonResource.ErrorMassage_SecurityException);
_logger.LogError(exc, $"{FilesLinkUtility.AuthKey} {validateResult}: {context.Request.Url()}"); _logger.Error(FilesLinkUtility.AuthKey, validateResult, context.Request.Url(), exc);
context.Response.StatusCode = (int)HttpStatusCode.Forbidden; context.Response.StatusCode = (int)HttpStatusCode.Forbidden;
await context.Response.WriteAsync(FilesCommonResource.ErrorMassage_SecurityException); await context.Response.WriteAsync(FilesCommonResource.ErrorMassage_SecurityException);
@ -609,7 +609,7 @@ public class FileHandlerService
var stringPayload = JsonWebToken.Decode(header, _fileUtility.SignatureSecret); var stringPayload = JsonWebToken.Decode(header, _fileUtility.SignatureSecret);
_logger.LogDebug("DocService StreamFile payload: {payload}", stringPayload); _logger.DebugDocServiceStreamFilePayload(stringPayload);
//var data = JObject.Parse(stringPayload); //var data = JObject.Parse(stringPayload);
//if (data == null) //if (data == null)
//{ //{
@ -631,7 +631,7 @@ public class FileHandlerService
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, ("Download stream header " + context.Request.Url())); _logger.ErrorDownloadStreamHeader(context.Request.Url(), ex);
context.Response.StatusCode = (int)HttpStatusCode.Forbidden; context.Response.StatusCode = (int)HttpStatusCode.Forbidden;
await context.Response.WriteAsync(FilesCommonResource.ErrorMassage_SecurityException); await context.Response.WriteAsync(FilesCommonResource.ErrorMassage_SecurityException);
return; return;
@ -678,7 +678,7 @@ public class FileHandlerService
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, ("Error for: " + context.Request.Url())); _logger.ErrorForUrl(context.Request.Url(), ex);
context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
await context.Response.WriteAsync(ex.Message); await context.Response.WriteAsync(ex.Message);
return; return;
@ -693,7 +693,7 @@ public class FileHandlerService
} }
catch (HttpException he) catch (HttpException he)
{ {
_logger.LogError(he, "StreamFile"); _logger.ErrorStreamFile(he);
} }
} }
@ -716,7 +716,7 @@ public class FileHandlerService
var stringPayload = JsonWebToken.Decode(header, _fileUtility.SignatureSecret); var stringPayload = JsonWebToken.Decode(header, _fileUtility.SignatureSecret);
_logger.LogDebug("DocService EmptyFile payload: {payload}", stringPayload); _logger.DebugDocServiceStreamFilePayload(stringPayload);
//var data = JObject.Parse(stringPayload); //var data = JObject.Parse(stringPayload);
//if (data == null) //if (data == null)
//{ //{
@ -738,7 +738,7 @@ public class FileHandlerService
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, ("Download stream header " + context.Request.Url())); _logger.ErrorDownloadStreamHeader(context.Request.Url(), ex);
context.Response.StatusCode = (int)HttpStatusCode.Forbidden; context.Response.StatusCode = (int)HttpStatusCode.Forbidden;
await context.Response.WriteAsync(FilesCommonResource.ErrorMassage_SecurityException); await context.Response.WriteAsync(FilesCommonResource.ErrorMassage_SecurityException);
return; return;
@ -772,7 +772,7 @@ public class FileHandlerService
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, ("Error for: " + context.Request.Url())); _logger.ErrorForUrl(context.Request.Url(), ex);
context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
await context.Response.WriteAsync(ex.Message); await context.Response.WriteAsync(ex.Message);
return; return;
@ -786,7 +786,7 @@ public class FileHandlerService
} }
catch (HttpException he) catch (HttpException he)
{ {
_logger.LogError(he, "EmptyFile"); _logger.ErrorEmptyFile(he);
} }
} }
@ -800,7 +800,7 @@ public class FileHandlerService
{ {
var exc = new HttpException((int)HttpStatusCode.Forbidden, FilesCommonResource.ErrorMassage_SecurityException); var exc = new HttpException((int)HttpStatusCode.Forbidden, FilesCommonResource.ErrorMassage_SecurityException);
_logger.LogError(exc, $"{FilesLinkUtility.AuthKey} {validateResult}: {context.Request.Url()}"); _logger.Error(FilesLinkUtility.AuthKey, validateResult, context.Request.Url(), exc);
context.Response.StatusCode = (int)HttpStatusCode.Forbidden; context.Response.StatusCode = (int)HttpStatusCode.Forbidden;
await context.Response.WriteAsync(FilesCommonResource.ErrorMassage_SecurityException); await context.Response.WriteAsync(FilesCommonResource.ErrorMassage_SecurityException);
@ -838,7 +838,7 @@ public class FileHandlerService
} }
catch (HttpException he) catch (HttpException he)
{ {
_logger.LogError(he, "TempFile"); _logger.ErrorTempFile(he);
} }
} }
@ -873,7 +873,7 @@ public class FileHandlerService
{ {
var exc = new HttpException((int)HttpStatusCode.Forbidden, FilesCommonResource.ErrorMassage_SecurityException); var exc = new HttpException((int)HttpStatusCode.Forbidden, FilesCommonResource.ErrorMassage_SecurityException);
_logger.LogError(exc, $"{FilesLinkUtility.AuthKey} {validateResult}: {context.Request.Url()}"); _logger.Error(FilesLinkUtility.AuthKey, validateResult, context.Request.Url(), exc);
context.Response.StatusCode = (int)HttpStatusCode.Forbidden; context.Response.StatusCode = (int)HttpStatusCode.Forbidden;
await context.Response.WriteAsync(FilesCommonResource.ErrorMassage_SecurityException); await context.Response.WriteAsync(FilesCommonResource.ErrorMassage_SecurityException);
@ -921,7 +921,7 @@ public class FileHandlerService
{ {
context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
await context.Response.WriteAsync(ex.Message); await context.Response.WriteAsync(ex.Message);
_logger.LogError(ex, ("Error for: " + context.Request.Url())); _logger.ErrorForUrl(context.Request.Url(), ex);
return; return;
} }
@ -933,7 +933,7 @@ public class FileHandlerService
} }
catch (HttpException he) catch (HttpException he)
{ {
_logger.LogError(he, "DifferenceFile"); _logger.ErrorDifferenceFile(he);
} }
} }
@ -996,14 +996,14 @@ public class FileHandlerService
} }
catch (FileNotFoundException ex) catch (FileNotFoundException ex)
{ {
_logger.LogError(ex, ("Error for: " + context.Request.Url())); _logger.ErrorForUrl(context.Request.Url(), ex);
context.Response.StatusCode = (int)HttpStatusCode.NotFound; context.Response.StatusCode = (int)HttpStatusCode.NotFound;
await context.Response.WriteAsync(ex.Message); await context.Response.WriteAsync(ex.Message);
return; return;
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, ("Error for: " + context.Request.Url())); _logger.ErrorForUrl(context.Request.Url(), ex);
context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
await context.Response.WriteAsync(ex.Message); await context.Response.WriteAsync(ex.Message);
return; return;
@ -1016,7 +1016,7 @@ public class FileHandlerService
} }
catch (HttpException he) catch (HttpException he)
{ {
_logger.LogError(he, "Thumbnail"); _logger.ErrorThumbnail(he);
} }
} }
@ -1119,7 +1119,7 @@ public class FileHandlerService
private async Task InternalWriteError(HttpContext context, Exception ex, bool responseMessage) private async Task InternalWriteError(HttpContext context, Exception ex, bool responseMessage)
{ {
_logger.LogError(ex, "FileHandler"); _logger.ErrorFileHandler(ex);
if (responseMessage) if (responseMessage)
{ {
@ -1298,13 +1298,13 @@ public class FileHandlerService
private Task TrackFile<T>(HttpContext context, T fileId) private Task TrackFile<T>(HttpContext context, T fileId)
{ {
var auth = context.Request.Query[FilesLinkUtility.AuthKey].FirstOrDefault(); var auth = context.Request.Query[FilesLinkUtility.AuthKey].FirstOrDefault();
_logger.LogDebug("DocService track fileid: {fileId}", fileId); _logger.DebugDocServiceTrackFileid(fileId.ToString());
var callbackSpan = TimeSpan.FromDays(128); var callbackSpan = TimeSpan.FromDays(128);
var validateResult = _emailValidationKeyProvider.ValidateEmailKey(fileId.ToString(), auth ?? "", callbackSpan); var validateResult = _emailValidationKeyProvider.ValidateEmailKey(fileId.ToString(), auth ?? "", callbackSpan);
if (validateResult != EmailValidationKeyProvider.ValidationResult.Ok) if (validateResult != EmailValidationKeyProvider.ValidationResult.Ok)
{ {
_logger.LogError("DocService track auth error: {validateResult}, {authKey}: {auth}", validateResult.ToString(), FilesLinkUtility.AuthKey, auth); _logger.ErrorDocServiceTrackAuth(validateResult, FilesLinkUtility.AuthKey, auth);
throw new HttpException((int)HttpStatusCode.Forbidden, FilesCommonResource.ErrorMassage_SecurityException); throw new HttpException((int)HttpStatusCode.Forbidden, FilesCommonResource.ErrorMassage_SecurityException);
} }
@ -1321,7 +1321,7 @@ public class FileHandlerService
using var readStream = new StreamReader(receiveStream); using var readStream = new StreamReader(receiveStream);
body = await readStream.ReadToEndAsync(); body = await readStream.ReadToEndAsync();
_logger.LogDebug("DocService track body: {body}", body); _logger.DebugDocServiceTrackBody(body);
if (string.IsNullOrEmpty(body)) if (string.IsNullOrEmpty(body))
{ {
throw new ArgumentException("DocService request body is incorrect"); throw new ArgumentException("DocService request body is incorrect");
@ -1336,12 +1336,12 @@ public class FileHandlerService
} }
catch (JsonException e) catch (JsonException e)
{ {
_logger.LogError(e, "DocService track error read body"); _logger.ErrorDocServiceTrackReadBody(e);
throw new HttpException((int)HttpStatusCode.BadRequest, "DocService request is incorrect"); throw new HttpException((int)HttpStatusCode.BadRequest, "DocService request is incorrect");
} }
catch (Exception e) catch (Exception e)
{ {
_logger.LogError(e, "DocService track error read body"); _logger.ErrorDocServiceTrackReadBody(e);
throw new HttpException((int)HttpStatusCode.BadRequest, e.Message); throw new HttpException((int)HttpStatusCode.BadRequest, e.Message);
} }
@ -1361,7 +1361,7 @@ public class FileHandlerService
} }
catch (SignatureVerificationException ex) catch (SignatureVerificationException ex)
{ {
_logger.LogError(ex, "DocService track header"); _logger.ErrorDocServiceTrackHeader(ex);
throw new HttpException((int)HttpStatusCode.Forbidden, ex.Message); throw new HttpException((int)HttpStatusCode.Forbidden, ex.Message);
} }
} }
@ -1371,7 +1371,7 @@ public class FileHandlerService
var header = context.Request.Headers[_fileUtility.SignatureHeader].FirstOrDefault(); var header = context.Request.Headers[_fileUtility.SignatureHeader].FirstOrDefault();
if (string.IsNullOrEmpty(header) || !header.StartsWith("Bearer ")) if (string.IsNullOrEmpty(header) || !header.StartsWith("Bearer "))
{ {
_logger.LogError("DocService track header is null"); _logger.ErrorDocServiceTrackHeaderIsNull();
throw new HttpException((int)HttpStatusCode.Forbidden, FilesCommonResource.ErrorMassage_SecurityException); throw new HttpException((int)HttpStatusCode.Forbidden, FilesCommonResource.ErrorMassage_SecurityException);
} }
header = header.Substring("Bearer ".Length); header = header.Substring("Bearer ".Length);
@ -1380,7 +1380,7 @@ public class FileHandlerService
{ {
var stringPayload = JsonWebToken.Decode(header, _fileUtility.SignatureSecret); var stringPayload = JsonWebToken.Decode(header, _fileUtility.SignatureSecret);
_logger.LogDebug("DocService track payload: {payload}", stringPayload); _logger.DebugDocServiceTrackPayload(stringPayload);
var jsonPayload = JObject.Parse(stringPayload); var jsonPayload = JObject.Parse(stringPayload);
var data = jsonPayload["payload"]; var data = jsonPayload["payload"];
if (data == null) if (data == null)
@ -1391,7 +1391,7 @@ public class FileHandlerService
} }
catch (SignatureVerificationException ex) catch (SignatureVerificationException ex)
{ {
_logger.LogError(ex, "DocService track header"); _logger.ErrorDocServiceTrackHeader(ex);
throw new HttpException((int)HttpStatusCode.Forbidden, ex.Message); throw new HttpException((int)HttpStatusCode.Forbidden, ex.Message);
} }
} }
@ -1404,7 +1404,7 @@ public class FileHandlerService
} }
catch (Exception e) catch (Exception e)
{ {
_logger.LogError(e, "DocService track:"); _logger.ErrorDocServiceTrack(e);
throw new HttpException((int)HttpStatusCode.BadRequest, e.Message); throw new HttpException((int)HttpStatusCode.BadRequest, e.Message);
} }
result ??= new TrackResponse(); result ??= new TrackResponse();

View File

@ -61,14 +61,14 @@ public class ThirdPartyAppHandlerService
public async Task InvokeAsync(HttpContext context) public async Task InvokeAsync(HttpContext context)
{ {
_log.LogDebug("ThirdPartyApp: handler request - {url}", context.Request.Url()); _log.DebugThirdPartyAppHandlerRequest(context.Request.Url());
var message = string.Empty; var message = string.Empty;
try try
{ {
var app = ThirdPartySelector.GetApp(context.Request.Query[ThirdPartySelector.AppAttr]); var app = ThirdPartySelector.GetApp(context.Request.Query[ThirdPartySelector.AppAttr]);
_log.LogDebug("ThirdPartyApp: app - {app}", app); _log.DebugThirdPartyAppApp(app);
if (await app.RequestAsync(context)) if (await app.RequestAsync(context))
{ {
@ -82,7 +82,7 @@ public class ThirdPartyAppHandlerService
} }
catch (Exception e) catch (Exception e)
{ {
_log.LogError(e, "ThirdPartyApp"); _log.ErrorThirdPartyApp(e);
message = e.Message; message = e.Message;
} }

View File

@ -97,7 +97,7 @@ public class DocuSignHandlerService
private void Redirect(HttpContext context) private void Redirect(HttpContext context)
{ {
_log.LogInformation("DocuSign redirect query: {queryString}", context.Request.QueryString); _log.InformationDocuSignRedirectQuery(context.Request.QueryString);
var eventRedirect = context.Request.Query["event"].FirstOrDefault(); var eventRedirect = context.Request.Query["event"].FirstOrDefault();
switch (eventRedirect.ToLower()) switch (eventRedirect.ToLower())
@ -121,12 +121,12 @@ public class DocuSignHandlerService
private async Task WebhookAsync(HttpContext context) private async Task WebhookAsync(HttpContext context)
{ {
_log.LogInformation("DocuSign webhook: {QueryString}", context.Request.QueryString); _log.InformationDocuSignWebhook(context.Request.QueryString);
try try
{ {
var xmldoc = new XmlDocument(); var xmldoc = new XmlDocument();
xmldoc.Load(context.Request.Body); xmldoc.Load(context.Request.Body);
_log.LogInformation("DocuSign webhook outerXml: {outerXml}", xmldoc.OuterXml); _log.InformationDocuSignWebhookOuterXml(xmldoc.OuterXml);
var mgr = new XmlNamespaceManager(xmldoc.NameTable); var mgr = new XmlNamespaceManager(xmldoc.NameTable);
mgr.AddNamespace(XmlPrefix, "http://www.docusign.net/API/3.0"); mgr.AddNamespace(XmlPrefix, "http://www.docusign.net/API/3.0");
@ -141,7 +141,7 @@ public class DocuSignHandlerService
throw new Exception("DocuSign webhook unknown status: " + statusString); throw new Exception("DocuSign webhook unknown status: " + statusString);
} }
_log.LogInformation("DocuSign webhook: {envelopeId} {subject} {status}", envelopeId, subject, status); _log.InformationDocuSignWebhook2(envelopeId, subject, status);
var customFieldUserIdNode = GetSingleNode(envelopeStatusNode, "CustomFields/" + XmlPrefix + ":CustomField[" + XmlPrefix + ":Name='" + DocuSignHelper.UserField + "']", mgr); var customFieldUserIdNode = GetSingleNode(envelopeStatusNode, "CustomFields/" + XmlPrefix + ":CustomField[" + XmlPrefix + ":Name='" + DocuSignHelper.UserField + "']", mgr);
var userIdString = GetSingleNode(customFieldUserIdNode, "Value", mgr).InnerText; var userIdString = GetSingleNode(customFieldUserIdNode, "Value", mgr).InnerText;
@ -183,7 +183,7 @@ public class DocuSignHandlerService
} }
catch (Exception ex) catch (Exception ex)
{ {
_log.LogError(ex, ("DocuSign webhook save document: " + documentStatus.InnerText)); _log.ErrorDocuSignWebhookSaveDocument(documentStatus.InnerText, ex);
} }
} }
break; break;
@ -198,7 +198,7 @@ public class DocuSignHandlerService
} }
catch (Exception e) catch (Exception e)
{ {
_log.LogError(e, "DocuSign webhook"); _log.ErrorDocuSignWebhook(e);
throw new HttpException((int)HttpStatusCode.BadRequest, e.Message); throw new HttpException((int)HttpStatusCode.BadRequest, e.Message);
} }

View File

@ -0,0 +1,110 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class BoxAppLogger
{
[LoggerMessage(Level = LogLevel.Debug, Message = "BoxApp: get file {fileId}")]
public static partial void DebugBoxAppGetFile(this ILogger logger, string fileId);
[LoggerMessage(Level = LogLevel.Debug, Message = "BoxApp: locked by {userId}")]
public static partial void DebugBoxAppLockedBy(this ILogger logger, string userId);
[LoggerMessage(Level = LogLevel.Debug, Message = "BoxApp: get file stream url {url}")]
public static partial void DebugBoxAppGetFileStreamUrl(this ILogger logger, string url);
[LoggerMessage(Level = LogLevel.Debug, Message = "BoxApp: save file stream {fileId} from {from}")]
public static partial void DebugBoxAppSaveFileStream(this ILogger logger, string fileId, string from);
[LoggerMessage(Level = LogLevel.Debug, Message = "BoxApp: GetConvertedUri from {fileType} to {currentType} - {downloadUrl}")]
public static partial void DebugBoxAppGetConvertedUri(this ILogger logger, string fileType, string currentType, string downloadUrl);
[LoggerMessage(Level = LogLevel.Debug, Message = "BoxApp: save file totalSize - {streamLength}")]
public static partial void DebugBoxAppSaveFileTotalSize(this ILogger logger, long streamLength);
[LoggerMessage(Level = LogLevel.Debug, Message = "BoxApp: save file response - {response}")]
public static partial void DebugBoxAppSaveFileResponse(this ILogger logger, string response);
[LoggerMessage(Level = LogLevel.Debug, Message = "BoxApp: logout for {boxUserId}")]
public static partial void DebugBoxAppLogout(this ILogger logger, string boxUserId);
[LoggerMessage(Level = LogLevel.Debug, Message = "BoxApp: get file stream {fileId}")]
public static partial void DebugBoxAppGetFileStream(this ILogger logger, string fileId);
[LoggerMessage(Level = LogLevel.Debug, Message = "BoxApp: AddLinker {boxUserId}")]
public static partial void DebugBoxAppAddLinker(this ILogger logger, string boxUserId);
[LoggerMessage(Level = LogLevel.Debug, Message = "BoxApp: userinfo response - {response}")]
public static partial void DebugBoxAppUserInfoResponse(this ILogger logger, string response);
[LoggerMessage(Level = LogLevel.Debug, Message = "From box app new personal user '{email}' without culture {culture}")]
public static partial void DebugBoxAppFromBoxAppNewPersonalUser(this ILogger logger, string email, string culture);
[LoggerMessage(Level = LogLevel.Debug, Message = "BoxApp: new user {userId}")]
public static partial void DebugBoxAppNewUser(this ILogger logger, Guid userId);
[LoggerMessage(Level = LogLevel.Debug, Message = "BoxApp: file response - {response}")]
public static partial void DebugBoxAppFileResponse(this ILogger logger, string response);
[LoggerMessage(Level = LogLevel.Debug, Message = "BoxApp: GetAccessToken by code {code}")]
public static partial void DebugBoxAppGetAccessTokenByCode(this ILogger logger, string code);
[LoggerMessage(Level = LogLevel.Error, Message = "BoxApp: Error convert")]
public static partial void ErrorBoxAppConvert(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "BoxApp: Error save file")]
public static partial void ErrorBoxAppSaveFile(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "BoxApp: validate error {authKey} {validateResult}: {url}")]
public static partial void ErrorBoxAppValidateError(this ILogger logger, string authKey, EmailValidationKeyProvider.ValidationResult validateResult, Uri url, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "BoxApp: Error request {url}")]
public static partial void ErrorBoxAppErrorRequest(this ILogger logger, Uri url, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "BoxApp StreamFile")]
public static partial void ErrorBoxAppStreamFile(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "BoxApp: userinfo request")]
public static partial void ErrorBoxAppUserinfoRequest(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "BoxApp: file request")]
public static partial void ErrorBoxAppFileRequest(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "GetToken")]
public static partial void ErrorGetToken(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "BoxApp: file is null")]
public static partial void ErrorBoxAppFileIsNull(this ILogger logger);
[LoggerMessage(Level = LogLevel.Error, Message = "BoxApp: token is null")]
public static partial void ErrorBoxAppTokenIsNull(this ILogger logger);
[LoggerMessage(Level = LogLevel.Error, Message = "BoxApp: UserInfo is null")]
public static partial void ErrorBoxAppUserInfoIsNull(this ILogger logger);
[LoggerMessage(Level = LogLevel.Error, Message = "Error in userinfo request")]
public static partial void ErrorInUserInfoRequest(this ILogger logger);
}

View File

@ -0,0 +1,32 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class ChunkedUploadSessionLogger
{
[LoggerMessage(Level = LogLevel.Error, Message = "GetBreadCrumbs {folderId} with null")]
public static partial void ErrorInUserInfoRequest(this ILogger logger, string folderId);
}

View File

@ -0,0 +1,32 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class ChunkedUploaderHandlerLogger
{
[LoggerMessage(Level = LogLevel.Error, Message = "ChunkedUploaderHandlerService")]
public static partial void ErrorChunkedUploaderHandlerService(this ILogger logger, Exception exception);
}

View File

@ -0,0 +1,35 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class DocbuilderReportsUtilityLogger
{
[LoggerMessage(Level = LogLevel.Error, Message = "DocbuilderReportsUtility error")]
public static partial void ErrorDocbuilderReportsUtility(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "PublishTaskInfo DocbuilderReportsUtility")]
public static partial void ErrorPublishTaskInfo(this ILogger logger, Exception exception);
}

View File

@ -0,0 +1,47 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class DocuSignHandlerLogger
{
[LoggerMessage(Level = LogLevel.Error, Message = "DocuSign webhook save document: {text}")]
public static partial void ErrorDocuSignWebhookSaveDocument(this ILogger logger, string text, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "DocuSign webhook")]
public static partial void ErrorDocuSignWebhook(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Information, Message = "DocuSign redirect query: {queryString}")]
public static partial void InformationDocuSignRedirectQuery(this ILogger logger, QueryString queryString);
[LoggerMessage(Level = LogLevel.Information, Message = "DocuSign webhook: {queryString}")]
public static partial void InformationDocuSignWebhook(this ILogger logger, QueryString queryString);
[LoggerMessage(Level = LogLevel.Information, Message = "DocuSign webhook outerXml: {outerXml}")]
public static partial void InformationDocuSignWebhookOuterXml(this ILogger logger, string outerXml);
[LoggerMessage(Level = LogLevel.Information, Message = "DocuSign webhook: {envelopeId} {subject} {status}")]
public static partial void InformationDocuSignWebhook2(this ILogger logger, string envelopeId, string subject, DocuSignStatus status);
}

View File

@ -0,0 +1,53 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class DocuSignHelperLogger
{
[LoggerMessage(Level = LogLevel.Debug, Message = "DocuSing userInfo: {userInfo}")]
public static partial void DebugDocuSingUserInfo(this ILogger logger, string userInfo);
[LoggerMessage(Level = LogLevel.Debug, Message = "DocuSign hook url: {url}")]
public static partial void DebugDocuSingHookUrl (this ILogger logger, string url);
[LoggerMessage(Level = LogLevel.Debug, Message = "DocuSign createdEnvelope: {envelopeId}")]
public static partial void DebugDocuSingCreatedEnvelope(this ILogger logger, string envelopeId);
[LoggerMessage(Level = LogLevel.Debug, Message = "DocuSign senderView: {url}")]
public static partial void DebugDocuSingSenderView(this ILogger logger, string url);
[LoggerMessage(Level = LogLevel.Error, Message = "DocuSign refresh token for user {id}")]
public static partial void ErrorDocuSignRefreshToken(this ILogger logger, Guid id, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "Signer is undefined")]
public static partial void ErrorSignerIsUndefined(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Information, Message = "DocuSign refresh token for user {userId}")]
public static partial void InformationDocuSignRefreshToken(this ILogger logger, Guid userId);
[LoggerMessage(Level = LogLevel.Information, Message = "DocuSign webhook get stream: {documentId}")]
public static partial void InformationDocuSignWebhookGetStream(this ILogger logger, string documentId);
}

View File

@ -0,0 +1,67 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
using static ASC.Web.Core.Files.DocumentService.CommandResponse;
namespace ASC.Files.Core.Log;
internal static partial class DocumentServiceConnectorLogger
{
[LoggerMessage(Level = LogLevel.Debug, Message = "DocService convert from {fromExtension} to {toExtension} - {documentUri}, DocServiceConverterUrl:{docServiceConverterUrl}")]
public static partial void DebugDocServiceConvert(this ILogger logger, string fromExtension, string toExtension, string documentUri, string docServiceConverterUrl);
[LoggerMessage(Level = LogLevel.Debug, Message = "DocService command {method} fileId '{fileId}' docKey '{docKey}' callbackUrl '{callbackUrl}' users '{users}' meta '{meta}'")]
public static partial void DebugDocServiceCommand(this ILogger logger, CommandMethod method, string fileId, string docKey, string callbackUrl, string users, string meta);
[LoggerMessage(Level = LogLevel.Debug, Message = "DocService builder requestKey {requestKey} async {isAsync}")]
public static partial void DebugDocServiceBuilderRequestKey(this ILogger logger, string requestKey, bool isAsync);
[LoggerMessage(Level = LogLevel.Debug, Message = "DocService request version")]
public static partial void DebugDocServiceRequestVersion(this ILogger logger);
[LoggerMessage(Level = LogLevel.Error, Message = "DocService command error")]
public static partial void ErrorDocServiceCommandError(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "Healthcheck DocService check error")]
public static partial void ErrorDocServiceHealthcheck(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "Converter DocService check error")]
public static partial void ErrorConverterDocServiceCheckError(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "Document DocService check error")]
public static partial void ErrorDocumentDocServiceCheckError(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "Command DocService check error")]
public static partial void ErrorCommandDocServiceCheckError(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "DocService check error")]
public static partial void ErrorDocServiceCheck(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "DocService error")]
public static partial void ErrorDocServiceError(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "DocService command response: '{error}' {errorString}")]
public static partial void ErrorDocServiceCommandResponse(this ILogger logger, ErrorTypes error, string errorString);
}

View File

@ -0,0 +1,71 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class DocumentServiceTrackerLogger
{
[LoggerMessage(Level = LogLevel.Debug, Message = "Drop command: fileId '{fileId}' docKey '{fileKey}' for user {user}")]
public static partial void DebugDropCommand(this ILogger logger, string fileId, string fileKey, string user, Exception exception);
[LoggerMessage(Level = LogLevel.Debug, Message = "DocService storing to {path}")]
public static partial void DebugDocServiceStoring(this ILogger logger, string path);
[LoggerMessage(Level = LogLevel.Error, Message = "DocService save error. Version update. File id: '{fileId}'. UserId: {userId}. DocKey '{fileData}'")]
public static partial void ErrorDocServiceSaveVersionUpdate(this ILogger logger, string fileId, Guid userId, string fileData, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "DocService save error. File id: '{fileId}'. UserId: {userId}. DocKey '{docKey}'. DownloadUri: {downloadUri}")]
public static partial void ErrorDocServiceSave(this ILogger logger, string fileId, Guid userId, string docKey, string downloadUri, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "DocService mailMerge{index} error: userId - {userId}, url - {url}")]
public static partial void ErrorDocServiceMailMerge(this ILogger logger, string index, Guid userId, string url, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "DocService Error on save file to temp store")]
public static partial void ErrorDocServiceSaveFileToTempStore(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "DocService save history error")]
public static partial void ErrorDocServiceSavehistory(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "DocService drop failed for users {users}")]
public static partial void ErrorDocServiceDropFailed(this ILogger logger, List<string> users);
[LoggerMessage(Level = LogLevel.Error, Message = "DocService saving file {fileId} ({docKey}) with key {fileData}")]
public static partial void ErrorDocServiceSavingFile(this ILogger logger, string fileId, string docKey, string fileData);
[LoggerMessage(Level = LogLevel.Error, Message = "DocService save error. Empty url. File id: '{fileId}'. UserId: {userId}. DocKey '{key}'")]
public static partial void ErrorDocServiceSave2(this ILogger logger, string fileId, Guid userId, string key);
[LoggerMessage(Level = LogLevel.Information, Message = "DocService save error: anonymous author - {userId}")]
public static partial void InformationDocServiceSaveError(this ILogger logger, Guid userId, Exception exception);
[LoggerMessage(Level = LogLevel.Information, Message = "DocService editing file {fileId} ({docKey}) with key {fileKey} for {users}")]
public static partial void InformationDocServiceEditingFile(this ILogger logger, string fileId, string docKey, string fileKey, List<string> users);
[LoggerMessage(Level = LogLevel.Information, Message = "DocService userId is not Guid: {user}")]
public static partial void InformationDocServiceUserIdIsNotGuid(this ILogger logger, string user);
[LoggerMessage(Level = LogLevel.Information, Message = "DocService mailMerge {index}/{count} send: {response}")]
public static partial void InformationDocServiceMailMerge(this ILogger logger, int index, int count, string response);
}

View File

@ -0,0 +1,32 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class EditHistoryLogger
{
[LoggerMessage(Level = LogLevel.Error, Message = "DeSerialize old scheme exception")]
public static partial void ErrorDeSerializeOldScheme(this ILogger logger, Exception exception);
}

View File

@ -0,0 +1,44 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class EntryManagerLogger
{
[LoggerMessage(Level = LogLevel.Error, Message = "Error on update {fileId} to version {version}")]
public static partial void ErrorUpdateFile(this ILogger logger, string fileId, int version, Exception exception);
[LoggerMessage(Level = LogLevel.Information, Message = "Delete folder {folderId} in {parentId}")]
public static partial void InformationDeleteFolder(this ILogger logger, string folderId, string parentId);
[LoggerMessage(Level = LogLevel.Information, Message = "Delete file {fileId} in {parentId}")]
public static partial void InformationDeletefile(this ILogger logger, string fileId, string parentId);
[LoggerMessage(Level = LogLevel.Information, Message = "Move shared folder {folderId} from {parentId} to {toId}")]
public static partial void InformationMoveSharedFolder(this ILogger logger, string folderId, string parentId, string toId);
[LoggerMessage(Level = LogLevel.Information, Message = "Move shared folder {fileId} from {parentId} to {toId}")]
public static partial void InformationMoveSharedFile(this ILogger logger, string fileId, string parentId, string toId);
}

View File

@ -0,0 +1,35 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class FFmpegServiceLogger
{
[LoggerMessage(Level = LogLevel.Error, Message = "FFmpeg/avconv was not found in PATH or 'files.ffmpeg' setting")]
public static partial void ErrorFFmpeg(this ILogger logger);
[LoggerMessage(Level = LogLevel.Information, Message = "FFmpeg found in {path}")]
public static partial void InformationFFmpegFoundIn(this ILogger logger, string path);
}

View File

@ -0,0 +1,32 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class FactoryIndexerFileLogger
{
[LoggerMessage(Level = LogLevel.Error, Message = "FactoryIndexerFile")]
public static partial void ErrorFactoryIndexerFile(this ILogger logger, Exception exception);
}

View File

@ -0,0 +1,32 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class FactoryIndexerFolderLogger
{
[LoggerMessage(Level = LogLevel.Error, Message = "FactoryIndexerFolder")]
public static partial void ErrorFactoryIndexerFolder(this ILogger logger, Exception exception);
}

View File

@ -0,0 +1,47 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class FileConverterLogger
{
[LoggerMessage(Level = LogLevel.Debug, Message = "Run CheckConvertFilesStatus: count {count}")]
public static partial void DebugRunCheckConvertFilesStatus(this ILogger logger, int count);
[LoggerMessage(Level = LogLevel.Debug, Message = "CheckConvertFilesStatus iteration continue")]
public static partial void DebugCheckConvertFilesStatusIterationContinue(this ILogger logger);
[LoggerMessage(Level = LogLevel.Debug, Message = "CheckConvertFilesStatus iteration end")]
public static partial void DebugCheckConvertFilesStatusIterationEnd(this ILogger logger);
[LoggerMessage(Level = LogLevel.Error, Message = "Error convert {fileId} with url {url}")]
public static partial void ErrorConvertFileWithUrl(this ILogger logger, string fileId, string url, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "{operationResultError} ConvertUrl: {convertedFileUrl} fromUrl: {fileUri}")]
public static partial void ErrorOperation(this ILogger logger, string operationResultError, string convertedFileUrl, string fileUri, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "CheckConvertFilesStatus timeout: {fileId} ({contentLengthString})")]
public static partial void ErrorCheckConvertFilesStatus(this ILogger logger, string fileId, long contentLengthString);
}

View File

@ -0,0 +1,32 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class FileExceptionFilterAttributeLogger
{
[LoggerMessage(Level = LogLevel.Error, Message = "LogException")]
public static partial void ErrorLogException(this ILogger logger, Exception exception);
}

View File

@ -0,0 +1,104 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class FileHandlerLogger
{
[LoggerMessage(Level = LogLevel.Debug, Message = "DocService StreamFile payload: {payload}")]
public static partial void DebugDocServiceStreamFilePayload(this ILogger logger, string payload);
[LoggerMessage(Level = LogLevel.Debug, Message = "DocService track fileid: {fileId}")]
public static partial void DebugDocServiceTrackFileid(this ILogger logger, string fileId);
[LoggerMessage(Level = LogLevel.Debug, Message = "DocService track body: {body}")]
public static partial void DebugDocServiceTrackBody(this ILogger logger, string body);
[LoggerMessage(Level = LogLevel.Debug, Message = "DocService track payload: {payload}")]
public static partial void DebugDocServiceTrackPayload(this ILogger logger, string payload);
[LoggerMessage(Level = LogLevel.Error, Message = "BulkDownloadFile failed for user {id}")]
public static partial void ErrorBulkDownloadFileFailed(this ILogger logger, Guid id, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "DownloadFile")]
public static partial void ErrorDownloadFile(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "Url: {url} IsClientConnected:{isCancellationRequested}, line number:{line} frame:{stackFrame}")]
public static partial void ErrorUrl(this ILogger logger, Uri url, bool isCancellationRequested, int line, StackFrame stackFrame, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "{authKey} {validateResult}: {url}")]
public static partial void Error(this ILogger logger, string authKey, EmailValidationKeyProvider.ValidationResult validateResult, Uri url, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "Download stream header {url}")]
public static partial void ErrorDownloadStreamHeader(this ILogger logger, Uri url, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "Error for: {url}")]
public static partial void ErrorForUrl(this ILogger logger, Uri url, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "StreamFile")]
public static partial void ErrorStreamFile(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "EmptyFile")]
public static partial void ErrorEmptyFile(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "TempFile")]
public static partial void ErrorTempFile(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "DifferenceFile")]
public static partial void ErrorDifferenceFile(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "Thumbnail")]
public static partial void ErrorThumbnail(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "FileHandler")]
public static partial void ErrorFileHandler(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "DocService track error read body")]
public static partial void ErrorDocServiceTrackReadBody(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "DocService track header")]
public static partial void ErrorDocServiceTrackHeader(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "DocService track:")]
public static partial void ErrorDocServiceTrack(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "BulkDownload file error. File is not exist on storage. UserId: {userId}.")]
public static partial void ErrorBulkDownloadFile(this ILogger logger, Guid userId);
[LoggerMessage(Level = LogLevel.Error, Message = "Download file error. File is not exist on storage. File id: {fileId}.")]
public static partial void ErrorDownloadFile2(this ILogger logger, string fileId);
[LoggerMessage(Level = LogLevel.Error, Message = "DocService track auth error: {validateResult}, {authKey}: {auth}")]
public static partial void ErrorDocServiceTrackAuth(this ILogger logger, EmailValidationKeyProvider.ValidationResult validateResult, string authKey, string auth);
[LoggerMessage(Level = LogLevel.Error, Message = "DocService track header is null")]
public static partial void ErrorDocServiceTrackHeaderIsNull(this ILogger logger);
[LoggerMessage(Level = LogLevel.Information, Message = "Converting {fileTitle} (fileId: {fileId}) to mp4")]
public static partial void InformationConvertingToMp4(this ILogger logger, string fileTitle, string fileId);
[LoggerMessage(Level = LogLevel.Information, Message = "Starting file download (chunk {offset}-{endOffset})")]
public static partial void InformationStartingFileDownLoad(this ILogger logger, long offset, long endOffset);
}

View File

@ -0,0 +1,32 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class FileMarkerLogger
{
[LoggerMessage(Level = LogLevel.Error, Message = "ExecMarkFileAsNew")]
public static partial void ErrorExecMarkFileAsNew(this ILogger logger, Exception exception);
}

View File

@ -0,0 +1,35 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class FileSharingLogger
{
[LoggerMessage(Level = LogLevel.Error, Message = "GetSharedInfo")]
public static partial void ErrorGetSharedInfo(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "User {userId} can't get shared info for {fileEntryType} {entryId}")]
public static partial void ErrorUserCanTGetSharedInfo(this ILogger logger, Guid userId, FileEntryType fileEntryType, string entryId);
}

View File

@ -0,0 +1,44 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class FileStorageServiceLogger
{
[LoggerMessage(Level = LogLevel.Error, Message = "DocEditor")]
public static partial void ErrorDocEditor(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "CreateThumbnails")]
public static partial void ErrorCreateThumbnails(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "FileStorageService")]
public static partial void ErrorFileStorageService(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Information, Message = "Reassign provider {providerId} from {fromUser} to {toUser}")]
public static partial void InformationReassignProvider(this ILogger logger, int providerId, Guid fromUser, Guid toUser);
[LoggerMessage(Level = LogLevel.Information, Message = "Delete provider {providerId} for {userId}")]
public static partial void InformationDeleteProvider(this ILogger logger, int providerId, Guid userId);
}

View File

@ -0,0 +1,35 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class FilesMessageServiceLogger
{
[LoggerMessage(Level = LogLevel.Debug, Message = "Empty Request Headers for \"{action}\" type of event")]
public static partial void DebugEmptyRequestHeaders(this ILogger logger, MessageAction action);
[LoggerMessage(Level = LogLevel.Debug, Message = "Empty Http Request for \"{action}\" type of event")]
public static partial void DebugEmptyHttpRequest(this ILogger logger, MessageAction action);
}

View File

@ -0,0 +1,41 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class GlobalLogger
{
[LoggerMessage(Level = LogLevel.Critical, Message = "ClearCache action")]
public static partial void CriticalClearCacheAction(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Critical, Message = "ClearCache subscribe")]
public static partial void CriticalClearCacheSubscribe(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "GetFolderIdAndProccessFirstVisit")]
public static partial void ErrorGetFolderIdAndProccessFirstVisit(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "SaveFile")]
public static partial void ErrorSaveFile(this ILogger logger, Exception exception);
}

View File

@ -0,0 +1,161 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class GoogleDriveAppLogger
{
[LoggerMessage(Level = LogLevel.Debug, Message = "GoogleDriveApp: get file {fileId}")]
public static partial void DebugGoogleDriveAppGetFile(this ILogger logger, string fileId);
[LoggerMessage(Level = LogLevel.Debug, Message = "GoogleDriveApp: get file stream url {fileId}")]
public static partial void DebugGoogleDriveAppGetFileStreamUrl(this ILogger logger, string fileId);
[LoggerMessage(Level = LogLevel.Debug, Message = "GoogleDriveApp: save file stream {fileId} from {from}")]
public static partial void DebugGoogleDriveAppSaveFileStream(this ILogger logger, string fileId, string from);
[LoggerMessage(Level = LogLevel.Debug, Message = "GoogleDriveApp: GetConvertedUri from {fileType} to {currentType} - {downloadUrl}")]
public static partial void DebugGoogleDriveAppGetConvertedUri(this ILogger logger, string fileType, string currentType, string downloadUrl);
[LoggerMessage(Level = LogLevel.Debug, Message = "GoogleDriveApp: save file stream response - {result}")]
public static partial void DebugGoogleDriveAppSaveFileStream2(this ILogger logger, string result);
[LoggerMessage(Level = LogLevel.Debug, Message = "GoogleDriveApp: state - {state}")]
public static partial void DebugGoogleDriveAppState(this ILogger logger, string state);
[LoggerMessage(Level = LogLevel.Debug, Message = "GoogleDriveApp: logout for {googleUserId}")]
public static partial void DebugGoogleDriveAppLogout(this ILogger logger, string googleUserId);
[LoggerMessage(Level = LogLevel.Debug, Message = "GoogleDriveApp: file must be converted")]
public static partial void DebugGoogleDriveAppFileMustBeConverted(this ILogger logger);
[LoggerMessage(Level = LogLevel.Debug, Message = "GoogleDriveApp: get file stream {fileId}")]
public static partial void DebugGoogleDriveAppGetFileStream(this ILogger logger, string fileId);
[LoggerMessage(Level = LogLevel.Debug, Message = "GoogleDriveApp: get file stream downloadUrl - {downloadUrl}")]
public static partial void DebugGoogleDriveAppGetFileStreamDownloadUrl(this ILogger logger, string downloadUrl);
[LoggerMessage(Level = LogLevel.Debug, Message = "GoogleDriveApp: ConfirmConvertFile - {fileId}")]
public static partial void DebugGoogleDriveAppConfirmConvertFile(this ILogger logger, string fileId);
[LoggerMessage(Level = LogLevel.Debug, Message = "GoogleDriveApp: CreateFile folderId - {folderId} fileName - {fileName}")]
public static partial void DebugGoogleDriveAppCreateFile(this ILogger logger, string folderId, string fileName);
[LoggerMessage(Level = LogLevel.Debug, Message = "GoogleDriveApp: GetAccessToken by code {code}")]
public static partial void DebugGoogleDriveAppGetAccessTokenByCode(this ILogger logger, string code);
[LoggerMessage(Level = LogLevel.Debug, Message = "GoogleDriveApp: AddLinker {googleUserId}")]
public static partial void DebugGoogleDriveApAddLinker(this ILogger logger, string googleUserId);
[LoggerMessage(Level = LogLevel.Debug, Message = "From google app new personal user '{email}' without culture {culture}")]
public static partial void DebugFromGoogleAppNewPersonalUser(this ILogger logger, string email, string culture);
[LoggerMessage(Level = LogLevel.Debug, Message = "GoogleDriveApp: new user {userId}")]
public static partial void DebugGoogleDriveAppNewUser(this ILogger logger, Guid userId);
[LoggerMessage(Level = LogLevel.Debug, Message = "GoogleDriveApp: file response - {response}")]
public static partial void DebugGoogleDriveAppFileResponse(this ILogger logger, string response);
[LoggerMessage(Level = LogLevel.Debug, Message = "GoogleDriveApp: create from - {url}")]
public static partial void DebugGoogleDriveAppCreateFrom(this ILogger logger, string url);
[LoggerMessage(Level = LogLevel.Debug, Message = "GoogleDriveApp: create file")]
public static partial void DebugGoogleDriveAppCreateFile2(this ILogger logger);
[LoggerMessage(Level = LogLevel.Debug, Message = "GoogleDriveApp: create file totalSize - {size}")]
public static partial void DebugGoogleDriveAppCreateFileTotalSize(this ILogger logger, long size);
[LoggerMessage(Level = LogLevel.Debug, Message = "GoogleDriveApp: create file response - {response}")]
public static partial void DebugGoogleDriveAppCreateFileResponse(this ILogger logger, string response);
[LoggerMessage(Level = LogLevel.Debug, Message = "GoogleDriveApp: convert file")]
public static partial void DebugGoogleDriveAppConvertFile(this ILogger logger);
[LoggerMessage(Level = LogLevel.Debug, Message = "GoogleDriveApp: GetConvertedUri- {downloadUrl}")]
public static partial void DebugGoogleDriveAppGetConvertedUri2(this ILogger logger, string downloadUrl);
[LoggerMessage(Level = LogLevel.Debug, Message = "GoogleDriveApp: download exportLink - {downloadUrl}")]
public static partial void DebugGoogleDriveAppDownloadExportLink(this ILogger logger, string downloadUrl);
[LoggerMessage(Level = LogLevel.Debug, Message = "GoogleDriveApp: Try GetCorrectExt - {ext} for - {mimeType}")]
public static partial void DebugGoogleDriveAppTryGetCorrectExt(this ILogger logger, string ext, string mimeType);
[LoggerMessage(Level = LogLevel.Error, Message = "GoogleDriveApp: Error convert")]
public static partial void ErrorGoogleDriveAppConvert(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "GoogleDriveApp: Error save file stream")]
public static partial void ErrorGoogleDriveAppSaveFileStream(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "GoogleDriveApp: validate error {authKey} {validateResult}: {url}")]
public static partial void ErrorGoogleDriveAppValidate(this ILogger logger, string authKey, EmailValidationKeyProvider.ValidationResult validateResult, Uri url, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "GoogleDriveApp: Error request {url}")]
public static partial void ErrorGoogleDriveAppRequest(this ILogger logger, Uri url, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "GoogleDriveApp StreamFile")]
public static partial void ErrorGoogleDriveAppStreamFile(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "GoogleDriveApp: userinfo request")]
public static partial void ErrorGoogleDriveAppUserInfoRequest(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "GoogleDriveApp: file request")]
public static partial void ErrorGoogleDriveAppFileRequest(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "GoogleDriveApp: Error create file")]
public static partial void ErrorGoogleDriveAppCreateFile(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "GoogleDriveApp: Error GetConvertedUri")]
public static partial void ErrorGoogleDriveAppGetConvertedUri(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "GoogleDriveApp: Error download exportLink")]
public static partial void ErrorGoogleDriveAppDownLoadExportLink(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "GoogleDriveApp: file is null")]
public static partial void ErrorGoogleDriveAppFileIsNull(this ILogger logger);
[LoggerMessage(Level = LogLevel.Error, Message = "GoogleDriveApp: empty state")]
public static partial void ErrorGoogleDriveAppEmptyIsNull(this ILogger logger);
[LoggerMessage(Level = LogLevel.Error, Message = "GoogleDriveApp: token is null")]
public static partial void ErrorGoogleDriveAppTokenIsNull(this ILogger logger);
[LoggerMessage(Level = LogLevel.Error, Message = "GoogleDriveApp: UserInfo is null")]
public static partial void ErrorGoogleDriveAppUserInfoIsNull(this ILogger logger);
[LoggerMessage(Level = LogLevel.Error, Message = "GoogleDriveApp: ids is empty")]
public static partial void ErrorGoogleDriveAppIdsIsNull(this ILogger logger);
[LoggerMessage(Level = LogLevel.Error, Message = "GoogleDriveApp: Action not identified")]
public static partial void ErrorGoogleDriveAppActionNotIdentified(this ILogger logger);
[LoggerMessage(Level = LogLevel.Error, Message = "GoogleDriveApp: downloadUrl is null")]
public static partial void ErrorGoogleDriveAppDownloadUrlIsNull(this ILogger logger);
[LoggerMessage(Level = LogLevel.Error, Message = "GoogleDriveApp: Error convertUrl. size {size}")]
public static partial void ErrorGoogleDriveAppConvertUrl(this ILogger logger, string size);
[LoggerMessage(Level = LogLevel.Information, Message = "GoogleDriveApp: create copy - {fileName}")]
public static partial void InformationGoogleDriveAppCreateCopy(this ILogger logger, string fileName);
}

View File

@ -0,0 +1,32 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class GoogleDriveProviderInfoLogger
{
[LoggerMessage(Level = LogLevel.Error, Message = "GoogleDrive error")]
public static partial void ErrorGoogleDrive(this ILogger logger, Exception exception);
}

View File

@ -0,0 +1,32 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class GoogleDriveStorageLogger
{
[LoggerMessage(Level = LogLevel.Error, Message = "Error while trying to insert entity. GoogleDrive insert returned an error.")]
public static partial void ErrorWhileTryingToInsertEntity(this ILogger logger, Exception exception);
}

View File

@ -0,0 +1,38 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class ProviderAccountDaoLogger
{
[LoggerMessage(Level = LogLevel.Error, Message = "GetProvidersInfoInternal: user = {userId}")]
public static partial void ErrorGetProvidersInfoInternalUser(this ILogger logger, Guid userId, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "GetProvidersInfoInternal: linkId = {linkId} , folderType = {folderType} , user = {userId}")]
public static partial void ErrorGetProvidersInfoInternal(this ILogger logger, int linkId, FolderType folderType, Guid userId, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "UpdateProviderInfo: linkId = {linkId} , user = {userId}")]
public static partial void ErrorUpdateProviderInfo(this ILogger logger, int linkId, Guid userId, Exception exception);
}

View File

@ -0,0 +1,32 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class SharePointProviderInfoLogger
{
[LoggerMessage(Level = LogLevel.Warning, Message = "CheckAccess")]
public static partial void WarningCheckAccess(this ILogger logger, Exception exception);
}

View File

@ -0,0 +1,32 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class SharpBoxDaoBaseLogger
{
[LoggerMessage(Level = LogLevel.Error, Message = "Sharpbox makeId error")]
public static partial void ErrorSharpboxMakeId(this ILogger logger, Exception exception);
}

View File

@ -0,0 +1,32 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class SharpBoxProviderInfoLogger
{
[LoggerMessage(Level = LogLevel.Error, Message = "Sharpbox CheckAccess error")]
public static partial void ErrorSharpboxCheckAccess(this ILogger logger, Exception exception);
}

View File

@ -0,0 +1,38 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class ThirdPartyAppHandlerLogger
{
[LoggerMessage(Level = LogLevel.Debug, Message = "ThirdPartyApp: handler request - {url}")]
public static partial void DebugThirdPartyAppHandlerRequest(this ILogger logger, Uri url);
[LoggerMessage(Level = LogLevel.Debug, Message = "ThirdPartyApp: app - {app}")]
public static partial void DebugThirdPartyAppApp(this ILogger logger, IThirdPartyApp app);
[LoggerMessage(Level = LogLevel.Error, Message = "ThirdPartyApp")]
public static partial void ErrorThirdPartyApp(this ILogger logger, Exception exception);
}

View File

@ -0,0 +1,35 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class TokenLogger
{
[LoggerMessage(Level = LogLevel.Debug, Message = "Refresh token for app: {app}")]
public static partial void DebugRefreshToken(this ILogger logger, string app);
[LoggerMessage(Level = LogLevel.Error, Message = "Refresh token for app: {app}")]
public static partial void ErrorRefreshToken(this ILogger logger, string app, Exception exception);
}

View File

@ -0,0 +1,35 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.Log;
internal static partial class WordpressHelperLogger
{
[LoggerMessage(Level = LogLevel.Error, Message = "Get Wordpress info about me")]
public static partial void ErrorGetWordpressInfo(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "Create Wordpress post")]
public static partial void ErrorCreateWordpressPost(this ILogger logger, Exception exception);
}

View File

@ -194,7 +194,7 @@ public class ReportState
} }
catch (Exception e) catch (Exception e)
{ {
logger.LogError(e, "DocbuilderReportsUtility error"); logger.ErrorDocbuilderReportsUtility(e);
Exception = e.Message; Exception = e.Message;
Status = ReportStatus.Failed; Status = ReportStatus.Failed;
} }
@ -223,7 +223,7 @@ public class ReportState
} }
catch (Exception e) catch (Exception e)
{ {
logger.LogError(e, " PublishTaskInfo DocbuilderReportsUtility"); logger.ErrorPublishTaskInfo(e);
if (tries == 0) if (tries == 0)
{ {
throw; throw;

View File

@ -80,7 +80,7 @@ public class DocumentServiceConnector
SpreadsheetLayout spreadsheetLayout, SpreadsheetLayout spreadsheetLayout,
bool isAsync) bool isAsync)
{ {
_logger.LogDebug("DocService convert from {fromExtension} to {toExtension} - {documentUri}, DocServiceConverterUrl:{docServiceConverterUrl}", fromExtension, toExtension, documentUri, _filesLinkUtility.DocServiceConverterUrl); _logger.DebugDocServiceConvert(fromExtension, toExtension, documentUri, _filesLinkUtility.DocServiceConverterUrl);
try try
{ {
return Web.Core.Files.DocumentService.GetConvertedUriAsync( return Web.Core.Files.DocumentService.GetConvertedUriAsync(
@ -110,7 +110,7 @@ public class DocumentServiceConnector
string[] users = null, string[] users = null,
MetaData meta = null) MetaData meta = null)
{ {
_logger.LogDebug("DocService command {method} fileId '{fileId}' docKey '{docKey}' callbackUrl '{callbackUrl}' users '{users}' meta '{meta}'", method, fileId, docKeyForTrack, callbackUrl, users != null ? string.Join(", ", users) : null, JsonConvert.SerializeObject(meta)); _logger.DebugDocServiceCommand(method, fileId.ToString(), docKeyForTrack, callbackUrl, users != null ? string.Join(", ", users) : null, JsonConvert.SerializeObject(meta));
try try
{ {
var commandResponse = await CommandRequestAsync( var commandResponse = await CommandRequestAsync(
@ -129,11 +129,11 @@ public class DocumentServiceConnector
return true; return true;
} }
_logger.LogError("DocService command response: '{error}' {errorString}", commandResponse.Error, commandResponse.ErrorString); _logger.ErrorDocServiceCommandResponse(commandResponse.Error, commandResponse.ErrorString);
} }
catch (Exception e) catch (Exception e)
{ {
_logger.LogError(e, "DocService command error"); _logger.ErrorDocServiceCommandError(e);
} }
return false; return false;
@ -159,7 +159,7 @@ public class DocumentServiceConnector
requestKey = null; requestKey = null;
} }
_logger.LogDebug("DocService builder requestKey {requestKey} async {isAsync}", requestKey, isAsync); _logger.DebugDocServiceBuilderRequestKey(requestKey, isAsync);
try try
{ {
return await Web.Core.Files.DocumentService.DocbuilderRequestAsync( return await Web.Core.Files.DocumentService.DocbuilderRequestAsync(
@ -179,7 +179,7 @@ public class DocumentServiceConnector
public async Task<string> GetVersionAsync() public async Task<string> GetVersionAsync()
{ {
_logger.LogDebug("DocService request version"); _logger.DebugDocServiceRequestVersion();
try try
{ {
var commandResponse = await CommandRequestAsync( var commandResponse = await CommandRequestAsync(
@ -204,11 +204,11 @@ public class DocumentServiceConnector
return version; return version;
} }
_logger.LogError("DocService command response: '{error}' {errorString}", commandResponse.Error, commandResponse.ErrorString); _logger.ErrorDocServiceCommandResponse(commandResponse.Error, commandResponse.ErrorString);
} }
catch (Exception e) catch (Exception e)
{ {
_logger.LogError(e, "DocService command error"); _logger.ErrorDocServiceCommandError(e);
} }
return "4.1.5.1"; return "4.1.5.1";
@ -227,7 +227,7 @@ public class DocumentServiceConnector
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "Healthcheck DocService check error"); _logger.ErrorDocServiceHealthcheck(ex);
throw new Exception("Healthcheck url: " + ex.Message); throw new Exception("Healthcheck url: " + ex.Message);
} }
@ -250,7 +250,7 @@ public class DocumentServiceConnector
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "Converter DocService check error"); _logger.ErrorConverterDocServiceCheckError(ex);
throw new Exception("Converter url: " + ex.Message); throw new Exception("Converter url: " + ex.Message);
} }
@ -272,7 +272,7 @@ public class DocumentServiceConnector
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "Document DocService check error"); _logger.ErrorDocumentDocServiceCheckError(ex);
throw new Exception("Document server: " + ex.Message); throw new Exception("Document server: " + ex.Message);
} }
@ -287,7 +287,7 @@ public class DocumentServiceConnector
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "Command DocService check error"); _logger.ErrorCommandDocServiceCheckError(ex);
throw new Exception("Command url: " + ex.Message); throw new Exception("Command url: " + ex.Message);
} }
@ -306,7 +306,7 @@ public class DocumentServiceConnector
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "DocService check error"); _logger.ErrorDocServiceCheck(ex);
throw new Exception("Docbuilder url: " + ex.Message); throw new Exception("Docbuilder url: " + ex.Message);
} }
@ -382,7 +382,7 @@ public class DocumentServiceConnector
error += $" ({ex.Message})"; error += $" ({ex.Message})";
} }
_logger.LogError(ex, "DocService error"); _logger.ErrorDocServiceError(ex);
return new Exception(error, ex); return new Exception(error, ex);
} }

View File

@ -264,7 +264,7 @@ public class DocumentServiceTrackerHelper
if (!fileData.Key.Equals(docKey)) if (!fileData.Key.Equals(docKey))
{ {
_logger.LogInformation("DocService editing file {fileId} ({docKey}) with key {fileKey} for {users}", fileId, docKey, fileData.Key, string.Join(", ", fileData.Users)); _logger.InformationDocServiceEditingFile(fileId.ToString(), docKey, fileData.Key, fileData.Users);
usersDrop = fileData.Users; usersDrop = fileData.Users;
} }
else else
@ -273,7 +273,7 @@ public class DocumentServiceTrackerHelper
{ {
if (!Guid.TryParse(user, out var userId)) if (!Guid.TryParse(user, out var userId))
{ {
_logger.LogInformation("DocService userId is not Guid: {user}", user); _logger.InformationDocServiceUserIdIsNotGuid(user);
continue; continue;
} }
@ -286,7 +286,7 @@ public class DocumentServiceTrackerHelper
} }
catch (Exception e) catch (Exception e)
{ {
_logger.LogDebug("Drop command: fileId '{fileId}' docKey '{fileKey}' for user {user} : {message}", fileId, fileData.Key, user, e.Message); _logger.DebugDropCommand(fileId.ToString(), fileData.Key, user, e);
usersDrop.Add(userId.ToString()); usersDrop.Add(userId.ToString());
} }
} }
@ -296,7 +296,7 @@ public class DocumentServiceTrackerHelper
{ {
if (!await _documentServiceHelper.DropUserAsync(fileData.Key, usersDrop.ToArray(), fileId)) if (!await _documentServiceHelper.DropUserAsync(fileData.Key, usersDrop.ToArray(), fileId))
{ {
_logger.LogError("DocService drop failed for users {users}", string.Join(",", (IEnumerable<string>)usersDrop)); _logger.ErrorDocServiceDropFailed(usersDrop);
} }
} }
@ -333,7 +333,7 @@ public class DocumentServiceTrackerHelper
var docKey = _documentServiceHelper.GetDocKey(fileStable); var docKey = _documentServiceHelper.GetDocKey(fileStable);
if (!fileData.Key.Equals(docKey)) if (!fileData.Key.Equals(docKey))
{ {
_logger.LogError("DocService saving file {fileId} ({docKey}) with key {fileData}", fileId, docKey, fileData.Key); _logger.ErrorDocServiceSavingFile(fileId.ToString(), docKey, fileData.Key);
await StoringFileAfterErrorAsync(fileId, userId.ToString(), _documentServiceConnector.ReplaceDocumentAdress(fileData.Url)); await StoringFileAfterErrorAsync(fileId, userId.ToString(), _documentServiceConnector.ReplaceDocumentAdress(fileData.Url));
@ -353,7 +353,7 @@ public class DocumentServiceTrackerHelper
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogInformation(ex, "DocService save error: anonymous author - " + userId); _logger.InformationDocServiceSaveError(userId, ex);
if (!userId.Equals(ASC.Core.Configuration.Constants.Guest.ID)) if (!userId.Equals(ASC.Core.Configuration.Constants.Guest.ID))
{ {
comments.Add(FilesCommonResource.ErrorMassage_SaveAnonymous); comments.Add(FilesCommonResource.ErrorMassage_SaveAnonymous);
@ -374,11 +374,11 @@ public class DocumentServiceTrackerHelper
await _daoFactory.GetFileDao<T>().UpdateCommentAsync(file.Id, file.Version, string.Join("; ", comments)); await _daoFactory.GetFileDao<T>().UpdateCommentAsync(file.Id, file.Version, string.Join("; ", comments));
file = null; file = null;
_logger.LogError("DocService save error. Empty url. File id: '{fileId}'. UserId: {userId}. DocKey '{key}'", fileId, userId, fileData.Key); _logger.ErrorDocServiceSave2(fileId.ToString(), userId, fileData.Key);
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, string.Format("DocService save error. Version update. File id: '{fileId}'. UserId: {userId}. DocKey '{fileData}'", fileId, userId, fileData.Key)); _logger.ErrorDocServiceSaveVersionUpdate(fileId.ToString(), userId, fileData.Key, ex);
} }
} }
else else
@ -415,7 +415,7 @@ public class DocumentServiceTrackerHelper
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, string.Format("DocService save error. File id: '{0}'. UserId: {1}. DocKey '{2}'. DownloadUri: {3}", fileId, userId, fileData.Key, fileData.Url)); _logger.ErrorDocServiceSave(fileId.ToString(), userId, fileData.Key, fileData.Url, ex);
saveMessage = ex.Message; saveMessage = ex.Message;
await StoringFileAfterErrorAsync(fileId, userId.ToString(), _documentServiceConnector.ReplaceDocumentAdress(fileData.Url)); await StoringFileAfterErrorAsync(fileId, userId.ToString(), _documentServiceConnector.ReplaceDocumentAdress(fileData.Url));
@ -549,18 +549,14 @@ public class DocumentServiceTrackerHelper
}) })
{ {
var response = await _mailMergeTaskRunner.RunAsync(mailMergeTask, _clientFactory); var response = await _mailMergeTaskRunner.RunAsync(mailMergeTask, _clientFactory);
_logger.LogInformation("DocService mailMerge {index}/{count} send: {response}", _logger.InformationDocServiceMailMerge(fileData.MailMerge.RecordIndex + 1, fileData.MailMerge.RecordCount, response);
fileData.MailMerge.RecordIndex + 1, fileData.MailMerge.RecordCount, response);
} }
saveMessage = null; saveMessage = null;
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError( _logger.ErrorDocServiceMailMerge(fileData.MailMerge == null ? "" : " " + fileData.MailMerge.RecordIndex + "/" + fileData.MailMerge.RecordCount,
ex, userId, fileData.Url, ex);
string.Format("DocService mailMerge{index} error: userId - {userId}, url - {url}",
fileData.MailMerge == null ? "" : " " + fileData.MailMerge.RecordIndex + "/" + fileData.MailMerge.RecordCount,
userId, fileData.Url));
saveMessage = ex.Message; saveMessage = ex.Message;
} }
@ -604,11 +600,11 @@ public class DocumentServiceTrackerHelper
{ {
await store.SaveAsync(FileConstant.StorageDomainTmp, path, fileStream); await store.SaveAsync(FileConstant.StorageDomainTmp, path, fileStream);
} }
_logger.LogDebug("DocService storing to {path}", path); _logger.DebugDocServiceStoring(path);
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "DocService Error on save file to temp store"); _logger.ErrorDocServiceSaveFileToTempStore(ex);
} }
} }
@ -646,7 +642,7 @@ public class DocumentServiceTrackerHelper
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "DocService save history error"); _logger.ErrorDocServiceSavehistory(ex);
} }
} }
} }

View File

@ -106,7 +106,7 @@ public class FFmpegService
if (File.Exists(path)) if (File.Exists(path))
{ {
_fFmpegPath = path; _fFmpegPath = path;
_logger.LogInformation("FFmpeg found in {path}", path); _logger.InformationFFmpegFoundIn(path);
break; break;
} }
@ -138,7 +138,7 @@ public class FFmpegService
if (string.IsNullOrEmpty(_fFmpegPath)) if (string.IsNullOrEmpty(_fFmpegPath))
{ {
_logger.LogError("FFmpeg/avconv was not found in PATH or 'files.ffmpeg' setting"); _logger.ErrorFFmpeg();
throw new Exception("no ffmpeg"); throw new Exception("no ffmpeg");
} }
@ -199,7 +199,7 @@ public class FFmpegService
string line; string line;
while ((line = await reader.ReadLineAsync()) != null) while ((line = await reader.ReadLineAsync()) != null)
{ {
_logger.LogInformation(line); _logger.Information(line);
} }
} }
} }

View File

@ -55,7 +55,7 @@ class FileExceptionFilterAttribute : IExceptionFilter
{ {
while (err != null) while (err != null)
{ {
_logger.LogError(err, "LogException"); _logger.ErrorLogException(err);
err = err.InnerException; err = err.InnerException;
} }
} }

View File

@ -236,7 +236,7 @@ class FileDeleteOperation<T> : FileOperation<FileDeleteOperationData<T>, T>
catch (Exception ex) catch (Exception ex)
{ {
Error = ex.Message; Error = ex.Message;
Logger.LogError(ex, Error); Logger.ErrorWithException(ex);
} }
await LinkDao.DeleteAllLinkAsync(file.Id.ToString()); await LinkDao.DeleteAllLinkAsync(file.Id.ToString());

View File

@ -362,7 +362,8 @@ class FileDownloadOperation<T> : FileOperation<FileDownloadOperationData<T>, T>
catch (Exception ex) catch (Exception ex)
{ {
Error = ex.Message; Error = ex.Message;
Logger.LogError(ex, Error);
Logger.ErrorWithException(ex);
} }
} }
else else

View File

@ -377,7 +377,7 @@ class FileMoveCopyOperation<T> : FileOperation<FileMoveCopyOperationData<T>, T>
{ {
Error = ex.Message; Error = ex.Message;
Logger.LogError(ex, Error); Logger.ErrorWithException(ex);
} }
} }
@ -626,7 +626,8 @@ class FileMoveCopyOperation<T> : FileOperation<FileMoveCopyOperationData<T>, T>
catch (Exception ex) catch (Exception ex)
{ {
Error = ex.Message; Error = ex.Message;
Logger.LogError(ex, Error);
Logger.ErrorWithException(ex);
} }
} }

View File

@ -286,7 +286,7 @@ abstract class FileOperation<T, TId> : FileOperation where T : FileOperationData
catch (AuthorizingException authError) catch (AuthorizingException authError)
{ {
Error = FilesCommonResource.ErrorMassage_SecurityException; Error = FilesCommonResource.ErrorMassage_SecurityException;
Logger.LogError(new SecurityException(Error, authError), Error); Logger.ErrorWithException(new SecurityException(Error, authError));
} }
catch (AggregateException ae) catch (AggregateException ae)
{ {
@ -294,10 +294,7 @@ abstract class FileOperation<T, TId> : FileOperation where T : FileOperationData
} }
catch (Exception error) catch (Exception error)
{ {
Error = error is TaskCanceledException || error is OperationCanceledException Logger.ErrorWithException(error);
? FilesCommonResource.ErrorMassage_OperationCanceledException
: error.Message;
Logger.LogError(error, Error);
} }
finally finally
{ {

View File

@ -154,7 +154,7 @@ public class BoxApp : Consumer, IThirdPartyApp, IOAuthProvider
public File<string> GetFile(string fileId, out bool editable) public File<string> GetFile(string fileId, out bool editable)
{ {
_logger.LogDebug("BoxApp: get file {fileId}", fileId); _logger.DebugBoxAppGetFile(fileId);
fileId = ThirdPartySelector.GetFileId(fileId); fileId = ThirdPartySelector.GetFileId(fileId);
var token = _tokenHelper.GetToken(AppAttr); var token = _tokenHelper.GetToken(AppAttr);
@ -197,7 +197,7 @@ public class BoxApp : Consumer, IThirdPartyApp, IOAuthProvider
if (lockedBy != null) if (lockedBy != null)
{ {
var lockedUserId = lockedBy.Value<string>("id"); var lockedUserId = lockedBy.Value<string>("id");
_logger.LogDebug("BoxApp: locked by {userId}", lockedUserId); _logger.DebugBoxAppLockedBy(lockedUserId);
editable = CurrentUser(lockedUserId); editable = CurrentUser(lockedUserId);
} }
@ -215,7 +215,7 @@ public class BoxApp : Consumer, IThirdPartyApp, IOAuthProvider
var fileId = ThirdPartySelector.GetFileId(file.Id); var fileId = ThirdPartySelector.GetFileId(file.Id);
_logger.LogDebug("BoxApp: get file stream url {url}", fileId); _logger.DebugBoxAppGetFileStreamUrl(fileId);
var uriBuilder = new UriBuilder(_baseCommonLinkUtility.GetFullAbsolutePath(_thirdPartyAppHandlerService.HandlerPath)); var uriBuilder = new UriBuilder(_baseCommonLinkUtility.GetFullAbsolutePath(_thirdPartyAppHandlerService.HandlerPath));
if (uriBuilder.Uri.IsLoopback) if (uriBuilder.Uri.IsLoopback)
@ -235,10 +235,7 @@ public class BoxApp : Consumer, IThirdPartyApp, IOAuthProvider
public async Task SaveFileAsync(string fileId, string fileType, string downloadUrl, Stream stream) public async Task SaveFileAsync(string fileId, string fileType, string downloadUrl, Stream stream)
{ {
_logger.LogDebug("BoxApp: save file stream {fileId}" + _logger.DebugBoxAppSaveFileStream(fileId, stream == null ? downloadUrl : "stream");
(stream == null
? " from - " + downloadUrl
: " from stream"), fileId);
fileId = ThirdPartySelector.GetFileId(fileId); fileId = ThirdPartySelector.GetFileId(fileId);
var token = _tokenHelper.GetToken(AppAttr); var token = _tokenHelper.GetToken(AppAttr);
@ -246,7 +243,7 @@ public class BoxApp : Consumer, IThirdPartyApp, IOAuthProvider
var boxFile = GetBoxFile(fileId, token); var boxFile = GetBoxFile(fileId, token);
if (boxFile == null) if (boxFile == null)
{ {
_logger.LogError("BoxApp: file is null"); _logger.ErrorBoxAppFileIsNull();
throw new Exception("File not found"); throw new Exception("File not found");
} }
@ -264,7 +261,7 @@ public class BoxApp : Consumer, IThirdPartyApp, IOAuthProvider
downloadUrl = _documentServiceConnector.ReplaceCommunityAdress(downloadUrl); downloadUrl = _documentServiceConnector.ReplaceCommunityAdress(downloadUrl);
} }
_logger.LogDebug("BoxApp: GetConvertedUri from {fileType} to {currentType} - {downloadUrl}", fileType, currentType, downloadUrl); _logger.DebugBoxAppGetConvertedUri(fileType, currentType, downloadUrl);
var key = DocumentServiceConnector.GenerateRevisionId(downloadUrl); var key = DocumentServiceConnector.GenerateRevisionId(downloadUrl);
@ -275,7 +272,7 @@ public class BoxApp : Consumer, IThirdPartyApp, IOAuthProvider
} }
catch (Exception e) catch (Exception e)
{ {
_logger.LogError(e, "BoxApp: Error convert"); _logger.ErrorBoxAppConvert(e);
} }
} }
@ -317,7 +314,7 @@ public class BoxApp : Consumer, IThirdPartyApp, IOAuthProvider
request.Method = HttpMethod.Post; request.Method = HttpMethod.Post;
request.Headers.Add("Authorization", "Bearer " + token); request.Headers.Add("Authorization", "Bearer " + token);
request.Content.Headers.ContentType = new MediaTypeHeaderValue("multipart/form-data; boundary=" + boundary); request.Content.Headers.ContentType = new MediaTypeHeaderValue("multipart/form-data; boundary=" + boundary);
_logger.LogDebug("BoxApp: save file totalSize - {streamLength}", tmpStream.Length); _logger.DebugBoxAppSaveFileTotalSize(tmpStream.Length);
tmpStream.Seek(0, SeekOrigin.Begin); tmpStream.Seek(0, SeekOrigin.Begin);
request.Content = new StreamContent(tmpStream); request.Content = new StreamContent(tmpStream);
@ -334,11 +331,11 @@ public class BoxApp : Consumer, IThirdPartyApp, IOAuthProvider
result = await readStream.ReadToEndAsync(); result = await readStream.ReadToEndAsync();
} }
_logger.LogDebug("BoxApp: save file response - {response}", result); _logger.DebugBoxAppSaveFileResponse(result);
} }
catch (HttpRequestException e) catch (HttpRequestException e)
{ {
_logger.LogError(e, "BoxApp: Error save file"); _logger.ErrorBoxAppSaveFile(e);
if (e.StatusCode == HttpStatusCode.Forbidden || e.StatusCode == HttpStatusCode.Unauthorized) if (e.StatusCode == HttpStatusCode.Forbidden || e.StatusCode == HttpStatusCode.Unauthorized)
{ {
throw new SecurityException(FilesCommonResource.ErrorMassage_SecurityException, e); throw new SecurityException(FilesCommonResource.ErrorMassage_SecurityException, e);
@ -354,7 +351,7 @@ public class BoxApp : Consumer, IThirdPartyApp, IOAuthProvider
var token = GetToken(context.Request.Query["code"]); var token = GetToken(context.Request.Query["code"]);
if (token == null) if (token == null)
{ {
_logger.LogError("BoxApp: token is null"); _logger.ErrorBoxAppTokenIsNull();
throw new SecurityException("Access token is null"); throw new SecurityException("Access token is null");
} }
@ -365,7 +362,7 @@ public class BoxApp : Consumer, IThirdPartyApp, IOAuthProvider
{ {
if (!CurrentUser(boxUserId)) if (!CurrentUser(boxUserId))
{ {
_logger.LogDebug("BoxApp: logout for {boxUserId}", boxUserId); _logger.DebugBoxAppLogout(boxUserId);
_cookiesManager.ClearCookies(CookiesType.AuthKey); _cookiesManager.ClearCookies(CookiesType.AuthKey);
_authContext.Logout(); _authContext.Logout();
} }
@ -377,7 +374,7 @@ public class BoxApp : Consumer, IThirdPartyApp, IOAuthProvider
if (userInfo == null) if (userInfo == null)
{ {
_logger.LogError("BoxApp: UserInfo is null"); _logger.ErrorBoxAppUserInfoIsNull();
throw new Exception("Profile is null"); throw new Exception("Profile is null");
} }
@ -417,14 +414,14 @@ public class BoxApp : Consumer, IThirdPartyApp, IOAuthProvider
var auth = context.Request.Query[FilesLinkUtility.AuthKey]; var auth = context.Request.Query[FilesLinkUtility.AuthKey];
var userId = context.Request.Query[CommonLinkUtility.ParamName_UserUserID]; var userId = context.Request.Query[CommonLinkUtility.ParamName_UserUserID];
_logger.LogDebug("BoxApp: get file stream {fileId}", fileId); _logger.DebugBoxAppGetFileStream(fileId);
var validateResult = _emailValidationKeyProvider.ValidateEmailKey(fileId + userId, auth, _global.StreamUrlExpire); var validateResult = _emailValidationKeyProvider.ValidateEmailKey(fileId + userId, auth, _global.StreamUrlExpire);
if (validateResult != EmailValidationKeyProvider.ValidationResult.Ok) if (validateResult != EmailValidationKeyProvider.ValidationResult.Ok)
{ {
var exc = new HttpException((int)HttpStatusCode.Forbidden, FilesCommonResource.ErrorMassage_SecurityException); var exc = new HttpException((int)HttpStatusCode.Forbidden, FilesCommonResource.ErrorMassage_SecurityException);
_logger.LogError(exc, string.Format("BoxApp: validate error {0} {1}: {2}", FilesLinkUtility.AuthKey, validateResult, context.Request.Url())); _logger.ErrorBoxAppValidateError(FilesLinkUtility.AuthKey, validateResult, context.Request.Url(), exc);
throw exc; throw exc;
} }
@ -438,7 +435,7 @@ public class BoxApp : Consumer, IThirdPartyApp, IOAuthProvider
if (token == null) if (token == null)
{ {
_logger.LogError("BoxApp: token is null"); _logger.ErrorBoxAppTokenIsNull();
throw new SecurityException("Access token is null"); throw new SecurityException("Access token is null");
} }
@ -459,7 +456,7 @@ public class BoxApp : Consumer, IThirdPartyApp, IOAuthProvider
{ {
context.Response.StatusCode = (int)HttpStatusCode.BadRequest; context.Response.StatusCode = (int)HttpStatusCode.BadRequest;
await context.Response.WriteAsync(ex.Message); await context.Response.WriteAsync(ex.Message);
_logger.LogError(ex, ("BoxApp: Error request " + context.Request.Url())); _logger.ErrorBoxAppErrorRequest(context.Request.Url(), ex);
} }
try try
@ -471,7 +468,7 @@ public class BoxApp : Consumer, IThirdPartyApp, IOAuthProvider
} }
catch (HttpException ex) catch (HttpException ex)
{ {
_logger.LogError(ex, "BoxApp StreamFile"); _logger.ErrorBoxAppStreamFile(ex);
} }
} }
@ -485,7 +482,7 @@ public class BoxApp : Consumer, IThirdPartyApp, IOAuthProvider
private void AddLinker(string boxUserId) private void AddLinker(string boxUserId)
{ {
_logger.LogDebug("BoxApp: AddLinker {boxUserId}", boxUserId); _logger.DebugBoxAppAddLinker(boxUserId);
var linker = _snapshot.Get("webstudio"); var linker = _snapshot.Get("webstudio");
linker.AddLink(_authContext.CurrentAccount.ID.ToString(), boxUserId, ProviderConstants.Box); linker.AddLink(_authContext.CurrentAccount.ID.ToString(), boxUserId, ProviderConstants.Box);
} }
@ -495,7 +492,7 @@ public class BoxApp : Consumer, IThirdPartyApp, IOAuthProvider
isNew = false; isNew = false;
if (token == null) if (token == null)
{ {
_logger.LogError("BoxApp: token is null"); _logger.ErrorBoxAppTokenIsNull();
throw new SecurityException("Access token is null"); throw new SecurityException("Access token is null");
} }
@ -505,17 +502,17 @@ public class BoxApp : Consumer, IThirdPartyApp, IOAuthProvider
{ {
resultResponse = _requestHelper.PerformRequest(_boxUrlUserInfo, resultResponse = _requestHelper.PerformRequest(_boxUrlUserInfo,
headers: new Dictionary<string, string> { { "Authorization", "Bearer " + token } }); headers: new Dictionary<string, string> { { "Authorization", "Bearer " + token } });
_logger.LogDebug("BoxApp: userinfo response - {response}", resultResponse); _logger.DebugBoxAppUserInfoResponse(resultResponse);
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "BoxApp: userinfo request"); _logger.ErrorBoxAppUserinfoRequest(ex);
} }
var boxUserInfo = JObject.Parse(resultResponse); var boxUserInfo = JObject.Parse(resultResponse);
if (boxUserInfo == null) if (boxUserInfo == null)
{ {
_logger.LogError("Error in userinfo request"); _logger.ErrorInUserInfoRequest();
return null; return null;
} }
@ -544,7 +541,7 @@ public class BoxApp : Consumer, IThirdPartyApp, IOAuthProvider
} }
else else
{ {
_logger.LogDebug("From box app new personal user '{email}' without culture {culture}", userInfo.Email, cultureName); _logger.DebugBoxAppFromBoxAppNewPersonalUser(userInfo.Email, cultureName);
} }
if (string.IsNullOrEmpty(userInfo.FirstName)) if (string.IsNullOrEmpty(userInfo.FirstName))
@ -568,7 +565,7 @@ public class BoxApp : Consumer, IThirdPartyApp, IOAuthProvider
isNew = true; isNew = true;
_logger.LogDebug("BoxApp: new user {userId}", userInfo.Id); _logger.DebugBoxAppNewUser(userInfo.Id);
} }
return userInfo; return userInfo;
@ -578,7 +575,7 @@ public class BoxApp : Consumer, IThirdPartyApp, IOAuthProvider
{ {
if (token == null) if (token == null)
{ {
_logger.LogError("BoxApp: token is null"); _logger.ErrorBoxAppTokenIsNull();
throw new SecurityException("Access token is null"); throw new SecurityException("Access token is null");
} }
@ -587,13 +584,13 @@ public class BoxApp : Consumer, IThirdPartyApp, IOAuthProvider
{ {
var resultResponse = _requestHelper.PerformRequest(_boxUrlFile.Replace("{fileId}", boxFileId), var resultResponse = _requestHelper.PerformRequest(_boxUrlFile.Replace("{fileId}", boxFileId),
headers: new Dictionary<string, string> { { "Authorization", "Bearer " + token } }); headers: new Dictionary<string, string> { { "Authorization", "Bearer " + token } });
_logger.LogDebug("BoxApp: file response - {response}", resultResponse); _logger.DebugBoxAppFileResponse(resultResponse);
return resultResponse; return resultResponse;
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "BoxApp: file request"); _logger.ErrorBoxAppFileRequest(ex);
} }
return null; return null;
} }
@ -602,14 +599,14 @@ public class BoxApp : Consumer, IThirdPartyApp, IOAuthProvider
{ {
try try
{ {
_logger.LogDebug("BoxApp: GetAccessToken by code {code}", code); _logger.DebugBoxAppGetAccessTokenByCode(code);
var token = _oAuth20TokenHelper.GetAccessToken<BoxApp>(ConsumerFactory, code); var token = _oAuth20TokenHelper.GetAccessToken<BoxApp>(ConsumerFactory, code);
return new Token(token, AppAttr); return new Token(token, AppAttr);
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "GetToken"); _logger.ErrorGetToken(ex);
} }
return null; return null;

View File

@ -171,7 +171,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
public File<string> GetFile(string fileId, out bool editable) public File<string> GetFile(string fileId, out bool editable)
{ {
_logger.LogDebug("GoogleDriveApp: get file {fileId}", fileId); _logger.DebugGoogleDriveAppGetFile(fileId);
fileId = ThirdPartySelector.GetFileId(fileId); fileId = ThirdPartySelector.GetFileId(fileId);
var token = _tokenHelper.GetToken(AppAttr); var token = _tokenHelper.GetToken(AppAttr);
@ -219,7 +219,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
private string GetFileStreamUrl(string fileId) private string GetFileStreamUrl(string fileId)
{ {
_logger.LogDebug("GoogleDriveApp: get file stream url {fileId}", fileId); _logger.DebugGoogleDriveAppGetFileStreamUrl(fileId);
var uriBuilder = new UriBuilder(_baseCommonLinkUtility.GetFullAbsolutePath(_thirdPartyAppHandlerService.HandlerPath)); var uriBuilder = new UriBuilder(_baseCommonLinkUtility.GetFullAbsolutePath(_thirdPartyAppHandlerService.HandlerPath));
if (uriBuilder.Uri.IsLoopback) if (uriBuilder.Uri.IsLoopback)
@ -239,10 +239,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
public async Task SaveFileAsync(string fileId, string fileType, string downloadUrl, Stream stream) public async Task SaveFileAsync(string fileId, string fileType, string downloadUrl, Stream stream)
{ {
_logger.LogDebug("GoogleDriveApp: save file stream {fileId}" + _logger.DebugGoogleDriveAppSaveFileStream(fileId, stream == null ? downloadUrl : "stream");
(stream == null
? " from - " + downloadUrl
: " from stream"), fileId);
fileId = ThirdPartySelector.GetFileId(fileId); fileId = ThirdPartySelector.GetFileId(fileId);
var token = _tokenHelper.GetToken(AppAttr); var token = _tokenHelper.GetToken(AppAttr);
@ -250,7 +247,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
var driveFile = GetDriveFile(fileId, token); var driveFile = GetDriveFile(fileId, token);
if (driveFile == null) if (driveFile == null)
{ {
_logger.LogError("GoogleDriveApp: file is null"); _logger.ErrorGoogleDriveAppFileIsNull();
throw new Exception("File not found"); throw new Exception("File not found");
} }
@ -267,7 +264,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
downloadUrl = _documentServiceConnector.ReplaceCommunityAdress(downloadUrl); downloadUrl = _documentServiceConnector.ReplaceCommunityAdress(downloadUrl);
} }
_logger.LogDebug("GoogleDriveApp: GetConvertedUri from {fileType} to {currentType} - {downloadUrl}", fileType, currentType, downloadUrl); _logger.DebugGoogleDriveAppGetConvertedUri(fileType, currentType, downloadUrl);
var key = DocumentServiceConnector.GenerateRevisionId(downloadUrl); var key = DocumentServiceConnector.GenerateRevisionId(downloadUrl);
@ -278,7 +275,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
} }
catch (Exception e) catch (Exception e)
{ {
_logger.LogError(e, "GoogleDriveApp: Error convert"); _logger.ErrorGoogleDriveAppConvert(e);
} }
} }
@ -315,11 +312,11 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
result = await readStream.ReadToEndAsync(); result = await readStream.ReadToEndAsync();
} }
_logger.LogDebug("GoogleDriveApp: save file stream response - {result}", result); _logger.DebugGoogleDriveAppSaveFileStream2(result);
} }
catch (HttpRequestException e) catch (HttpRequestException e)
{ {
_logger.LogError(e, "GoogleDriveApp: Error save file stream"); _logger.ErrorGoogleDriveAppSaveFileStream(e);
if (e.StatusCode == HttpStatusCode.Forbidden || e.StatusCode == HttpStatusCode.Unauthorized) if (e.StatusCode == HttpStatusCode.Forbidden || e.StatusCode == HttpStatusCode.Unauthorized)
{ {
throw new SecurityException(FilesCommonResource.ErrorMassage_SecurityException, e); throw new SecurityException(FilesCommonResource.ErrorMassage_SecurityException, e);
@ -332,10 +329,10 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
private async Task RequestCodeAsync(HttpContext context) private async Task RequestCodeAsync(HttpContext context)
{ {
var state = context.Request.Query["state"]; var state = context.Request.Query["state"];
_logger.LogDebug("GoogleDriveApp: state - {state}", state); _logger.DebugGoogleDriveAppState(state);
if (string.IsNullOrEmpty(state)) if (string.IsNullOrEmpty(state))
{ {
_logger.LogError("GoogleDriveApp: empty state"); _logger.ErrorGoogleDriveAppEmptyIsNull();
throw new Exception("Empty state"); throw new Exception("Empty state");
} }
@ -343,7 +340,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
var token = GetToken(context.Request.Query["code"]); var token = GetToken(context.Request.Query["code"]);
if (token == null) if (token == null)
{ {
_logger.LogError("GoogleDriveApp: token is null"); _logger.ErrorGoogleDriveAppTokenIsNull();
throw new SecurityException("Access token is null"); throw new SecurityException("Access token is null");
} }
@ -356,7 +353,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
{ {
if (!CurrentUser(googleUserId)) if (!CurrentUser(googleUserId))
{ {
_logger.LogDebug("GoogleDriveApp: logout for {googleUserId}", googleUserId); _logger.DebugGoogleDriveAppLogout(googleUserId);
_cookiesManager.ClearCookies(CookiesType.AuthKey); _cookiesManager.ClearCookies(CookiesType.AuthKey);
_authContext.Logout(); _authContext.Logout();
} }
@ -368,7 +365,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
if (userInfo == null) if (userInfo == null)
{ {
_logger.LogError("GoogleDriveApp: UserInfo is null"); _logger.ErrorGoogleDriveAppUserInfoIsNull();
throw new Exception("Profile is null"); throw new Exception("Profile is null");
} }
@ -407,7 +404,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
var idsArray = stateJson.Value<JArray>("ids") ?? stateJson.Value<JArray>("exportIds"); var idsArray = stateJson.Value<JArray>("ids") ?? stateJson.Value<JArray>("exportIds");
if (idsArray == null) if (idsArray == null)
{ {
_logger.LogError("GoogleDriveApp: ids is empty"); _logger.ErrorGoogleDriveAppIdsIsNull();
throw new Exception("File id is null"); throw new Exception("File id is null");
} }
@ -416,7 +413,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
var driveFile = GetDriveFile(fileId, token); var driveFile = GetDriveFile(fileId, token);
if (driveFile == null) if (driveFile == null)
{ {
_logger.LogError("GoogleDriveApp: file is null"); _logger.ErrorGoogleDriveAppFileIsNull();
throw new Exception("File not found"); throw new Exception("File not found");
} }
@ -426,7 +423,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
if (_fileUtility.ExtsMustConvert.Contains(ext) if (_fileUtility.ExtsMustConvert.Contains(ext)
|| GoogleLoginProvider.GoogleDriveExt.Contains(ext)) || GoogleLoginProvider.GoogleDriveExt.Contains(ext))
{ {
_logger.LogDebug("GoogleDriveApp: file must be converted"); _logger.DebugGoogleDriveAppFileMustBeConverted();
if (_filesSettingsHelper.ConvertNotify) if (_filesSettingsHelper.ConvertNotify)
{ {
//context.Response.Redirect(App.Location + "?" + FilesLinkUtility.FileId + "=" + HttpUtility.UrlEncode(fileId), true); //context.Response.Redirect(App.Location + "?" + FilesLinkUtility.FileId + "=" + HttpUtility.UrlEncode(fileId), true);
@ -441,7 +438,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
return; return;
} }
_logger.LogError("GoogleDriveApp: Action not identified"); _logger.ErrorGoogleDriveAppActionNotIdentified();
throw new Exception("Action not identified"); throw new Exception("Action not identified");
} }
@ -454,14 +451,14 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
var auth = context.Request.Query[FilesLinkUtility.AuthKey]; var auth = context.Request.Query[FilesLinkUtility.AuthKey];
var userId = context.Request.Query[CommonLinkUtility.ParamName_UserUserID]; var userId = context.Request.Query[CommonLinkUtility.ParamName_UserUserID];
_logger.LogDebug("GoogleDriveApp: get file stream {fileId}", fileId); _logger.DebugGoogleDriveAppGetFileStream(fileId);
var validateResult = _emailValidationKeyProvider.ValidateEmailKey(fileId + userId, auth, _global.StreamUrlExpire); var validateResult = _emailValidationKeyProvider.ValidateEmailKey(fileId + userId, auth, _global.StreamUrlExpire);
if (validateResult != EmailValidationKeyProvider.ValidationResult.Ok) if (validateResult != EmailValidationKeyProvider.ValidationResult.Ok)
{ {
var exc = new HttpException((int)HttpStatusCode.Forbidden, FilesCommonResource.ErrorMassage_SecurityException); var exc = new HttpException((int)HttpStatusCode.Forbidden, FilesCommonResource.ErrorMassage_SecurityException);
_logger.LogError(exc, string.Format("GoogleDriveApp: validate error {0} {1}: {2}", FilesLinkUtility.AuthKey, validateResult, context.Request.Url())); _logger.ErrorGoogleDriveAppValidate(FilesLinkUtility.AuthKey, validateResult, context.Request.Url(), exc);
throw exc; throw exc;
} }
@ -475,7 +472,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
if (token == null) if (token == null)
{ {
_logger.LogError("BoxApp: token is null"); _logger.ErrorGoogleDriveAppTokenIsNull();
throw new SecurityException("Access token is null"); throw new SecurityException("Access token is null");
} }
@ -488,12 +485,12 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
if (string.IsNullOrEmpty(downloadUrl)) if (string.IsNullOrEmpty(downloadUrl))
{ {
_logger.LogError("GoogleDriveApp: downloadUrl is null"); _logger.ErrorGoogleDriveAppDownloadUrlIsNull();
throw new Exception("downloadUrl is null"); throw new Exception("downloadUrl is null");
} }
_logger.LogDebug("GoogleDriveApp: get file stream downloadUrl - {downloadUrl}", downloadUrl); _logger.DebugGoogleDriveAppGetFileStreamDownloadUrl(downloadUrl);
var request = new HttpRequestMessage var request = new HttpRequestMessage
{ {
@ -515,7 +512,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
{ {
context.Response.StatusCode = (int)HttpStatusCode.BadRequest; context.Response.StatusCode = (int)HttpStatusCode.BadRequest;
await context.Response.WriteAsync(ex.Message); await context.Response.WriteAsync(ex.Message);
_logger.LogError(ex, ("GoogleDriveApp: Error request " + context.Request.Url())); _logger.ErrorGoogleDriveAppRequest(context.Request.Url(), ex);
} }
try try
{ {
@ -526,21 +523,21 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
} }
catch (HttpException ex) catch (HttpException ex)
{ {
_logger.LogError(ex, "GoogleDriveApp StreamFile"); _logger.ErrorGoogleDriveAppStreamFile(ex);
} }
} }
private async Task ConfirmConvertFileAsync(HttpContext context) private async Task ConfirmConvertFileAsync(HttpContext context)
{ {
var fileId = context.Request.Query[FilesLinkUtility.FileId]; var fileId = context.Request.Query[FilesLinkUtility.FileId];
_logger.LogDebug("GoogleDriveApp: ConfirmConvertFile - {fileId}", fileId); _logger.DebugGoogleDriveAppConfirmConvertFile(fileId);
var token = _tokenHelper.GetToken(AppAttr); var token = _tokenHelper.GetToken(AppAttr);
var driveFile = GetDriveFile(fileId, token); var driveFile = GetDriveFile(fileId, token);
if (driveFile == null) if (driveFile == null)
{ {
_logger.LogError("GoogleDriveApp: file is null"); _logger.ErrorGoogleDriveAppFileIsNull();
throw new Exception("File not found"); throw new Exception("File not found");
} }
@ -554,7 +551,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
{ {
var folderId = context.Request.Query[FilesLinkUtility.FolderId]; var folderId = context.Request.Query[FilesLinkUtility.FolderId];
var fileName = context.Request.Query[FilesLinkUtility.FileTitle]; var fileName = context.Request.Query[FilesLinkUtility.FileTitle];
_logger.LogDebug("GoogleDriveApp: CreateFile folderId - {folderId} fileName - {fileName}", folderId, fileName); _logger.DebugGoogleDriveAppCreateFile(folderId, fileName);
var token = _tokenHelper.GetToken(AppAttr); var token = _tokenHelper.GetToken(AppAttr);
@ -578,7 +575,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
} }
if (driveFile == null) if (driveFile == null)
{ {
_logger.LogError("GoogleDriveApp: file is null"); _logger.ErrorGoogleDriveAppFileIsNull();
throw new Exception("File not created"); throw new Exception("File not created");
} }
@ -593,14 +590,14 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
{ {
try try
{ {
_logger.LogDebug("GoogleDriveApp: GetAccessToken by code {code}", code); _logger.DebugGoogleDriveAppGetAccessTokenByCode(code);
var token = _oAuth20TokenHelper.GetAccessToken<GoogleDriveApp>(ConsumerFactory, code); var token = _oAuth20TokenHelper.GetAccessToken<GoogleDriveApp>(ConsumerFactory, code);
return new Token(token, AppAttr); return new Token(token, AppAttr);
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "GetToken"); _logger.ErrorGetToken(ex);
} }
return null; return null;
@ -617,7 +614,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
private void AddLinker(string googleUserId) private void AddLinker(string googleUserId)
{ {
_logger.LogDebug("GoogleDriveApp: AddLinker {googleUserId}", googleUserId); _logger.DebugGoogleDriveApAddLinker(googleUserId);
var linker = _snapshot.Get("webstudio"); var linker = _snapshot.Get("webstudio");
linker.AddLink(_authContext.CurrentAccount.ID.ToString(), googleUserId, ProviderConstants.Google); linker.AddLink(_authContext.CurrentAccount.ID.ToString(), googleUserId, ProviderConstants.Google);
} }
@ -627,7 +624,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
isNew = false; isNew = false;
if (token == null) if (token == null)
{ {
_logger.LogError("GoogleDriveApp: token is null"); _logger.ErrorGoogleDriveAppTokenIsNull();
throw new SecurityException("Access token is null"); throw new SecurityException("Access token is null");
} }
@ -639,12 +636,12 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "GoogleDriveApp: userinfo request"); _logger.ErrorGoogleDriveAppUserInfoRequest(ex);
} }
if (loginProfile == null) if (loginProfile == null)
{ {
_logger.LogError("Error in userinfo request"); _logger.ErrorInUserInfoRequest();
return null; return null;
} }
@ -667,7 +664,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
} }
else else
{ {
_logger.LogDebug("From google app new personal user '{email}' without culture {culture}", userInfo.Email, cultureName); _logger.DebugFromGoogleAppNewPersonalUser(userInfo.Email, cultureName);
} }
try try
@ -682,7 +679,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
isNew = true; isNew = true;
_logger.LogDebug("GoogleDriveApp: new user {userId}", userInfo.Id); _logger.DebugGoogleDriveAppNewUser(userInfo.Id);
} }
return userInfo; return userInfo;
@ -692,7 +689,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
{ {
if (token == null) if (token == null)
{ {
_logger.LogError("GoogleDriveApp: token is null"); _logger.ErrorGoogleDriveAppTokenIsNull();
throw new SecurityException("Access token is null"); throw new SecurityException("Access token is null");
} }
@ -701,13 +698,13 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
var requestUrl = GoogleLoginProvider.GoogleUrlFile + googleFileId + "?fields=" + HttpUtility.UrlEncode(GoogleLoginProvider.FilesFields); var requestUrl = GoogleLoginProvider.GoogleUrlFile + googleFileId + "?fields=" + HttpUtility.UrlEncode(GoogleLoginProvider.FilesFields);
var resultResponse = _requestHelper.PerformRequest(requestUrl, var resultResponse = _requestHelper.PerformRequest(requestUrl,
headers: new Dictionary<string, string> { { "Authorization", "Bearer " + token } }); headers: new Dictionary<string, string> { { "Authorization", "Bearer " + token } });
_logger.LogDebug("GoogleDriveApp: file response - {response}", resultResponse); _logger.DebugGoogleDriveAppFileResponse(resultResponse);
return resultResponse; return resultResponse;
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "GoogleDriveApp: file request"); _logger.ErrorGoogleDriveAppFileRequest(ex);
} }
return null; return null;
} }
@ -716,12 +713,12 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
{ {
if (string.IsNullOrEmpty(contentUrl)) if (string.IsNullOrEmpty(contentUrl))
{ {
_logger.LogError("GoogleDriveApp: downloadUrl is null"); _logger.ErrorGoogleDriveAppDownloadUrlIsNull();
throw new Exception("downloadUrl is null"); throw new Exception("downloadUrl is null");
} }
_logger.LogDebug("GoogleDriveApp: create from - {url}", contentUrl); _logger.DebugGoogleDriveAppCreateFrom(contentUrl);
var request = new HttpRequestMessage var request = new HttpRequestMessage
{ {
@ -737,7 +734,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
private async Task<string> CreateFileAsync(Stream content, string fileName, string folderId, Token token) private async Task<string> CreateFileAsync(Stream content, string fileName, string folderId, Token token)
{ {
_logger.LogDebug("GoogleDriveApp: create file"); _logger.DebugGoogleDriveAppCreateFile2();
var httpClient = _clientFactory.CreateClient(); var httpClient = _clientFactory.CreateClient();
@ -770,7 +767,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
request.Headers.Add("Authorization", "Bearer " + token); request.Headers.Add("Authorization", "Bearer " + token);
request.Content.Headers.ContentType = new MediaTypeHeaderValue("multipart/related; boundary=" + boundary); request.Content.Headers.ContentType = new MediaTypeHeaderValue("multipart/related; boundary=" + boundary);
_logger.LogDebug("GoogleDriveApp: create file totalSize - {size}", tmpStream.Length); _logger.DebugGoogleDriveAppCreateFileTotalSize(tmpStream.Length);
request.Content = new StreamContent(tmpStream); request.Content = new StreamContent(tmpStream);
} }
@ -786,13 +783,13 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
result = await readStream.ReadToEndAsync(); result = await readStream.ReadToEndAsync();
} }
_logger.LogDebug("GoogleDriveApp: create file response - {response}", result); _logger.DebugGoogleDriveAppCreateFileResponse(result);
return result; return result;
} }
catch (HttpRequestException e) catch (HttpRequestException e)
{ {
_logger.LogError(e, "GoogleDriveApp: Error create file"); _logger.ErrorGoogleDriveAppCreateFile(e);
if (e.StatusCode == HttpStatusCode.Forbidden || e.StatusCode == HttpStatusCode.Unauthorized) if (e.StatusCode == HttpStatusCode.Forbidden || e.StatusCode == HttpStatusCode.Unauthorized)
{ {
@ -805,14 +802,14 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
private async Task<string> ConvertFileAsync(string fileId, string fromExt) private async Task<string> ConvertFileAsync(string fileId, string fromExt)
{ {
_logger.LogDebug("GoogleDriveApp: convert file"); _logger.DebugGoogleDriveAppConvertFile();
var downloadUrl = GetFileStreamUrl(fileId); var downloadUrl = GetFileStreamUrl(fileId);
var toExt = _fileUtility.GetInternalExtension(fromExt); var toExt = _fileUtility.GetInternalExtension(fromExt);
try try
{ {
_logger.LogDebug("GoogleDriveApp: GetConvertedUri- {downloadUrl}", downloadUrl); _logger.DebugGoogleDriveAppGetConvertedUri2(downloadUrl);
var key = DocumentServiceConnector.GenerateRevisionId(downloadUrl); var key = DocumentServiceConnector.GenerateRevisionId(downloadUrl);
@ -822,7 +819,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
} }
catch (Exception e) catch (Exception e)
{ {
_logger.LogError(e, "GoogleDriveApp: Error GetConvertedUri"); _logger.ErrorGoogleDriveAppGetConvertedUri(e);
} }
return downloadUrl; return downloadUrl;
@ -835,7 +832,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
var folderId = (string)jsonFile.SelectToken("parents[0]"); var folderId = (string)jsonFile.SelectToken("parents[0]");
_logger.LogInformation("GoogleDriveApp: create copy - {fileName}", fileName); _logger.InformationGoogleDriveAppCreateCopy(fileName);
var ext = GetCorrectExt(jsonFile); var ext = GetCorrectExt(jsonFile);
var fileId = jsonFile.Value<string>("id"); var fileId = jsonFile.Value<string>("id");
@ -857,7 +854,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
}; };
request.Headers.Add("Authorization", "Bearer " + token); request.Headers.Add("Authorization", "Bearer " + token);
_logger.LogDebug("GoogleDriveApp: download exportLink - {downloadUrl}", downloadUrl); _logger.DebugGoogleDriveAppDownloadExportLink(downloadUrl);
try try
{ {
using var response = await httpClient.SendAsync(request); using var response = await httpClient.SendAsync(request);
@ -866,7 +863,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
} }
catch (HttpRequestException e) catch (HttpRequestException e)
{ {
_logger.LogError(e, "GoogleDriveApp: Error download exportLink"); _logger.ErrorGoogleDriveAppDownLoadExportLink(e);
if (e.StatusCode == HttpStatusCode.Forbidden || e.StatusCode == HttpStatusCode.Unauthorized) if (e.StatusCode == HttpStatusCode.Forbidden || e.StatusCode == HttpStatusCode.Unauthorized)
{ {
@ -880,7 +877,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
if (string.IsNullOrEmpty(convertedUrl)) if (string.IsNullOrEmpty(convertedUrl))
{ {
_logger.LogError("GoogleDriveApp: Error convertUrl. size {size}", FileSizeComment.FilesSizeToString(jsonFile.Value<int>("size"))); _logger.ErrorGoogleDriveAppConvertUrl(FileSizeComment.FilesSizeToString(jsonFile.Value<int>("size")));
throw new Exception(FilesCommonResource.ErrorMassage_DocServiceException + " (convert)"); throw new Exception(FilesCommonResource.ErrorMassage_DocServiceException + " (convert)");
} }
@ -929,7 +926,7 @@ public class GoogleDriveApp : Consumer, IThirdPartyApp, IOAuthProvider
{ {
ext = MimeMapping.GetExtention(mimeType); ext = MimeMapping.GetExtention(mimeType);
_logger.LogDebug("GoogleDriveApp: Try GetCorrectExt - {ext} for - {mimeType}", ext, mimeType); _logger.DebugGoogleDriveAppTryGetCorrectExt(ext, mimeType);
} }
} }
} }

View File

@ -44,7 +44,7 @@ public class Token : OAuth20Token
var app = ThirdPartySelector.GetApp(App); var app = ThirdPartySelector.GetApp(App);
try try
{ {
tokenHelper.Logger.LogDebug("Refresh token for app: {App}", App); tokenHelper.Logger.DebugRefreshToken(App);
var refreshUrl = app.GetRefreshUrl(); var refreshUrl = app.GetRefreshUrl();
@ -62,7 +62,7 @@ public class Token : OAuth20Token
} }
catch (Exception ex) catch (Exception ex)
{ {
tokenHelper.Logger.LogError(ex, ("Refresh token for app: " + app)); tokenHelper.Logger.ErrorRefreshToken(App, ex);
} }
} }

View File

@ -1415,7 +1415,7 @@ public class EntryManager
} }
catch (Exception e) catch (Exception e)
{ {
_logger.LogError(e, string.Format("Error on update {0} to version {1}", fileId, version)); _logger.ErrorUpdateFile(fileId.ToString(), version, e);
throw new Exception(e.Message, e); throw new Exception(e.Message, e);
} }
@ -1574,14 +1574,14 @@ public class EntryManager
{ {
await DeleteSubitemsAsync(folder.Id, folderDao, fileDao, linkDao); await DeleteSubitemsAsync(folder.Id, folderDao, fileDao, linkDao);
_logger.LogInformation("Delete folder {folderId} in {parentId}", folder.Id, parentId); _logger.InformationDeleteFolder(folder.Id.ToString(), parentId.ToString());
await folderDao.DeleteFolderAsync(folder.Id); await folderDao.DeleteFolderAsync(folder.Id);
} }
var files = fileDao.GetFilesAsync(parentId, null, FilterType.None, false, Guid.Empty, string.Empty, true); var files = fileDao.GetFilesAsync(parentId, null, FilterType.None, false, Guid.Empty, string.Empty, true);
await foreach (var file in files) await foreach (var file in files)
{ {
_logger.LogInformation("Delete file {fileId} in {parentId}", file.Id, parentId); _logger.InformationDeletefile(file.Id.ToString(), parentId.ToString());
await fileDao.DeleteFileAsync(file.Id); await fileDao.DeleteFileAsync(file.Id);
await linkDao.DeleteAllLinkAsync(file.Id.ToString()); await linkDao.DeleteAllLinkAsync(file.Id.ToString());
@ -1600,7 +1600,7 @@ public class EntryManager
&& shares.Any(record => record.Share != FileShare.Restrict); && shares.Any(record => record.Share != FileShare.Restrict);
if (shared) if (shared)
{ {
_logger.LogInformation("Move shared folder {folderId} from {parentId} to {toId}", folder.Id, parentId, toId); _logger.InformationMoveSharedFolder(folder.Id.ToString(), parentId.ToString(), toId.ToString());
await folderDao.MoveFolderAsync(folder.Id, toId, null); await folderDao.MoveFolderAsync(folder.Id, toId, null);
} }
else else
@ -1615,7 +1615,7 @@ public class EntryManager
await foreach (var file in files) await foreach (var file in files)
{ {
_logger.LogInformation("Move shared file {fileId} from {parentId} to {toId}", file.Id, parentId, toId); _logger.InformationMoveSharedFile(file.Id.ToString(), parentId.ToString(), toId.ToString());
await fileDao.MoveFileAsync(file.Id, toId); await fileDao.MoveFileAsync(file.Id, toId);
} }
} }

View File

@ -24,6 +24,7 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 // content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
using Timeout = System.Threading.Timeout; using Timeout = System.Threading.Timeout;
namespace ASC.Web.Files.Utils; namespace ASC.Web.Files.Utils;
@ -149,7 +150,7 @@ internal class FileConverterQueue<T> : IDisposable
_cache.Remove(GetKey(q.Key)); _cache.Remove(GetKey(q.Key));
} }
logger.LogDebug("Run CheckConvertFilesStatus: count {count}", _conversionQueue.Count); logger.DebugRunCheckConvertFilesStatus(_conversionQueue.Count);
if (_conversionQueue.Count == 0) if (_conversionQueue.Count == 0)
{ {
@ -244,7 +245,7 @@ internal class FileConverterQueue<T> : IDisposable
var password = exception.InnerException is DocumentServiceException documentServiceException var password = exception.InnerException is DocumentServiceException documentServiceException
&& documentServiceException.Code == DocumentServiceException.ErrorCode.ConvertPassword; && documentServiceException.Code == DocumentServiceException.ErrorCode.ConvertPassword;
logger.LogError(exception, string.Format("Error convert {0} with url {1}", file.Id, fileUri)); logger.ErrorConvertFileWithUrl(file.Id.ToString(), fileUri, exception);
lock (_locker) lock (_locker)
{ {
if (_conversionQueue.TryGetValue(file, out var operationResult)) if (_conversionQueue.TryGetValue(file, out var operationResult))
@ -283,7 +284,7 @@ internal class FileConverterQueue<T> : IDisposable
{ {
operationResult.StopDateTime = DateTime.UtcNow; operationResult.StopDateTime = DateTime.UtcNow;
operationResult.Error = FilesCommonResource.ErrorMassage_ConvertTimeout; operationResult.Error = FilesCommonResource.ErrorMassage_ConvertTimeout;
logger.LogError("CheckConvertFilesStatus timeout: {fileId} ({contentLengthString})", file.Id, file.ContentLengthString); logger.ErrorCheckConvertFilesStatus(file.Id.ToString(), file.ContentLength);
} }
else else
{ {
@ -294,7 +295,7 @@ internal class FileConverterQueue<T> : IDisposable
} }
} }
logger.LogDebug("CheckConvertFilesStatus iteration continue"); logger.DebugCheckConvertFilesStatusIterationContinue();
continue; continue;
} }
@ -310,7 +311,7 @@ internal class FileConverterQueue<T> : IDisposable
{ {
operationResultError = e.Message; operationResultError = e.Message;
logger.LogError(e, "{operationResultError} ConvertUrl: {convertedFileUrl} fromUrl: {fileUri}", operationResultError, convertedFileUrl, fileUri); logger.ErrorOperation(operationResultError, convertedFileUrl, fileUri, e);
continue; continue;
} }
@ -349,7 +350,7 @@ internal class FileConverterQueue<T> : IDisposable
} }
} }
logger.LogDebug("CheckConvertFilesStatus iteration end"); logger.DebugCheckConvertFilesStatusIterationEnd();
} }
lock (_locker) lock (_locker)
@ -359,7 +360,7 @@ internal class FileConverterQueue<T> : IDisposable
} }
catch (Exception exception) catch (Exception exception)
{ {
logger.LogError(exception, exception.Message); logger.ErrorWithException(exception);
lock (_locker) lock (_locker)
{ {
_timer.Change(Timeout.Infinite, Timeout.Infinite); _timer.Change(Timeout.Infinite, Timeout.Infinite);

View File

@ -59,7 +59,7 @@ public class FileMarkerHelper<T>
} }
catch (Exception e) catch (Exception e)
{ {
_logger.LogError(e, "ExecMarkFileAsNew"); _logger.ErrorExecMarkFileAsNew(e);
} }
} }
} }

View File

@ -311,7 +311,7 @@ public class FileSharing
if (!await CanSetAccessAsync(entry)) if (!await CanSetAccessAsync(entry))
{ {
_logger.LogError("User {userId} can't get shared info for {fileEntryType} {entryId}", _authContext.CurrentAccount.ID, entry.FileEntryType == FileEntryType.File ? "file" : "folder", entry.Id); _logger.ErrorUserCanTGetSharedInfo(_authContext.CurrentAccount.ID, entry.FileEntryType, entry.Id.ToString());
throw new SecurityException(FilesCommonResource.ErrorMassage_SecurityException); throw new SecurityException(FilesCommonResource.ErrorMassage_SecurityException);
} }
@ -482,7 +482,7 @@ public class FileSharing
} }
catch (Exception e) catch (Exception e)
{ {
_logger.LogError(e, "GetSharedInfo"); _logger.ErrorGetSharedInfo(e);
throw new InvalidOperationException(e.Message, e); throw new InvalidOperationException(e.Message, e);
} }