Fix exception logging

This commit is contained in:
Bond_009 2018-12-20 13:11:26 +01:00
parent bf01918659
commit ea4c914123
123 changed files with 565 additions and 607 deletions

View File

@ -913,9 +913,9 @@ namespace Emby.Dlna.Didl
writer.WriteFullEndElement();
}
catch (XmlException)
catch (XmlException ex)
{
_logger.LogError("Error adding xml value: {value}", name);
_logger.LogError(ex, "Error adding xml value: {value}", name);
}
}
@ -925,9 +925,9 @@ namespace Emby.Dlna.Didl
{
writer.WriteElementString(prefix, name, namespaceUri, value);
}
catch (XmlException)
catch (XmlException ex)
{
_logger.LogError("Error adding xml value: {value}", value);
_logger.LogError(ex, "Error adding xml value: {value}", value);
}
}

View File

@ -58,7 +58,7 @@ namespace Emby.Dlna
}
catch (Exception ex)
{
_logger.LogError("Error extracting DLNA profiles.", ex);
_logger.LogError(ex, "Error extracting DLNA profiles.");
}
}
@ -198,7 +198,7 @@ namespace Emby.Dlna
}
catch (ArgumentException ex)
{
_logger.LogError("Error evaluating regex pattern {0}", ex, pattern);
_logger.LogError(ex, "Error evaluating regex pattern {0}", pattern);
return false;
}
}
@ -324,7 +324,7 @@ namespace Emby.Dlna
}
catch (Exception ex)
{
_logger.LogError("Error parsing profile file: {0}", ex, path);
_logger.LogError(ex, "Error parsing profile file: {0}", path);
return null;
}

View File

@ -185,7 +185,7 @@ namespace Emby.Dlna.Main
}
catch (Exception ex)
{
_logger.LogError("Error starting ssdp handlers", ex);
_logger.LogError(ex, "Error starting ssdp handlers");
}
}
@ -202,7 +202,7 @@ namespace Emby.Dlna.Main
}
catch (Exception ex)
{
_logger.LogError("Error starting device discovery", ex);
_logger.LogError(ex, "Error starting device discovery");
}
}
@ -215,7 +215,7 @@ namespace Emby.Dlna.Main
}
catch (Exception ex)
{
_logger.LogError("Error stopping device discovery", ex);
_logger.LogError(ex, "Error stopping device discovery");
}
}
@ -243,7 +243,7 @@ namespace Emby.Dlna.Main
}
catch (Exception ex)
{
_logger.LogError("Error registering endpoint", ex);
_logger.LogError(ex, "Error registering endpoint");
}
}
@ -361,7 +361,7 @@ namespace Emby.Dlna.Main
}
catch (Exception ex)
{
_logger.LogError("Error starting PlayTo manager", ex);
_logger.LogError(ex, "Error starting PlayTo manager");
}
}
}
@ -379,7 +379,7 @@ namespace Emby.Dlna.Main
}
catch (Exception ex)
{
_logger.LogError("Error disposing PlayTo manager", ex);
_logger.LogError(ex, "Error disposing PlayTo manager");
}
_manager = null;
}

View File

@ -140,7 +140,7 @@ namespace Emby.Dlna.PlayTo
}
catch (Exception ex)
{
_logger.LogError("Error updating device volume info for {0}", ex, Properties.Name);
_logger.LogError(ex, "Error updating device volume info for {0}", Properties.Name);
}
}
@ -507,7 +507,7 @@ namespace Emby.Dlna.PlayTo
if (_disposed)
return;
//_logger.LogError("Error updating device info for {0}", ex, Properties.Name);
//_logger.LogError(ex, "Error updating device info for {0}", Properties.Name);
_connectFailureCount++;
@ -767,7 +767,7 @@ namespace Emby.Dlna.PlayTo
}
catch (Exception ex)
{
_logger.LogError("Unable to parse xml {0}", ex, trackString);
_logger.LogError(ex, "Unable to parse xml {0}", trackString);
return new Tuple<bool, uBaseObject>(true, null);
}
}

View File

@ -156,7 +156,7 @@ namespace Emby.Dlna.PlayTo
}
catch (Exception ex)
{
_logger.LogError("Error reporting progress", ex);
_logger.LogError(ex, "Error reporting progress");
}
}
@ -204,7 +204,7 @@ namespace Emby.Dlna.PlayTo
}
catch (Exception ex)
{
_logger.LogError("Error reporting playback stopped", ex);
_logger.LogError(ex, "Error reporting playback stopped");
}
}
@ -223,7 +223,7 @@ namespace Emby.Dlna.PlayTo
}
catch (Exception ex)
{
_logger.LogError("Error reporting progress", ex);
_logger.LogError(ex, "Error reporting progress");
}
}
@ -247,7 +247,7 @@ namespace Emby.Dlna.PlayTo
}
catch (Exception ex)
{
_logger.LogError("Error reporting progress", ex);
_logger.LogError(ex, "Error reporting progress");
}
}
@ -278,7 +278,7 @@ namespace Emby.Dlna.PlayTo
}
catch (Exception ex)
{
_logger.LogError("Error reporting progress", ex);
_logger.LogError(ex, "Error reporting progress");
}
}

View File

@ -121,7 +121,7 @@ namespace Emby.Dlna.PlayTo
}
catch (Exception ex)
{
_logger.LogError("Error creating PlayTo device.", ex);
_logger.LogError(ex, "Error creating PlayTo device.");
}
finally
{

View File

@ -52,7 +52,7 @@ namespace Emby.Dlna.Service
}
catch (Exception ex)
{
_logger.LogError("Error processing control request", ex);
_logger.LogError(ex, "Error processing control request");
return new ControlErrorHandler().GetResponse(ex);
}

View File

@ -103,7 +103,7 @@ namespace Emby.Drawing.ImageMagick
}
catch
{
//_logger.LogError("Error loading webp: ", ex);
//_logger.LogError(ex, "Error loading webp: ");
_webpAvailable = false;
}
}
@ -295,7 +295,7 @@ namespace Emby.Drawing.ImageMagick
}
catch (Exception ex)
{
_logger.LogError("Error drawing indicator overlay", ex);
_logger.LogError(ex, "Error drawing indicator overlay");
}
}

View File

@ -214,7 +214,7 @@ namespace Emby.Drawing.Net
}
catch (Exception ex)
{
_logger.LogError("Error drawing indicator overlay", ex);
_logger.LogError(ex, "Error drawing indicator overlay");
}
}

View File

@ -660,7 +660,7 @@ namespace Emby.Drawing.Skia
}
catch (Exception ex)
{
_logger.LogError("Error drawing indicator overlay", ex);
_logger.LogError(ex, "Error drawing indicator overlay");
}
}

View File

@ -302,7 +302,7 @@ namespace Emby.Drawing
{
// Decoder failed to decode it
#if DEBUG
_logger.LogError("Error encoding image", ex);
_logger.LogError(ex, "Error encoding image");
#endif
// Just spit out the original file if all the options are default
return new Tuple<string, string, DateTime>(originalImagePath, MimeTypes.GetMimeType(originalImagePath), dateModified);
@ -310,7 +310,7 @@ namespace Emby.Drawing
catch (Exception ex)
{
// If it fails for whatever reason, return the original image
_logger.LogError("Error encoding image", ex);
_logger.LogError(ex, "Error encoding image");
// Just spit out the original file if all the options are default
return new Tuple<string, string, DateTime>(originalImagePath, MimeTypes.GetMimeType(originalImagePath), dateModified);
@ -603,7 +603,7 @@ namespace Emby.Drawing
}
catch (Exception ex)
{
_logger.LogError("Image conversion failed for {0}", ex, originalImagePath);
_logger.LogError(ex, "Image conversion failed for {originalImagePath}", originalImagePath);
}
}
@ -660,7 +660,7 @@ namespace Emby.Drawing
}
catch (Exception ex)
{
_logger.LogError("Error enhancing image", ex);
_logger.LogError(ex, "Error enhancing image");
}
return new ValueTuple<string, DateTime, bool>(originalImagePath, dateModified, inputImageSupportsTransparency);
@ -853,7 +853,7 @@ namespace Emby.Drawing
}
catch (Exception ex)
{
_logger.LogError("Error in image enhancer: {0}", ex, i.GetType().Name);
_logger.LogError(ex, "Error in image enhancer: {0}", i.GetType().Name);
}
}

View File

@ -134,7 +134,7 @@ namespace Emby.Notifications
}
catch (Exception ex)
{
_logger.LogError("Error sending notification to {0}", ex, service.Name);
_logger.LogError(ex, "Error sending notification to {0}", service.Name);
}
}
@ -146,7 +146,7 @@ namespace Emby.Notifications
}
catch (Exception ex)
{
_logger.LogError("Error in IsEnabledForUser", ex);
_logger.LogError(ex, "Error in IsEnabledForUser");
return false;
}
}
@ -177,7 +177,7 @@ namespace Emby.Notifications
}
catch (Exception ex)
{
_logger.LogError("Error in GetNotificationTypes", ex);
_logger.LogError(ex, "Error in GetNotificationTypes");
return new List<NotificationTypeInfo>();
}

View File

@ -273,7 +273,7 @@ namespace Emby.Notifications
}
catch (Exception ex)
{
_logger.LogError("Error sending notification", ex);
_logger.LogError(ex, "Error sending notification");
}
}

View File

@ -170,9 +170,9 @@ namespace Emby.Photos
}
}
}
catch (Exception e)
catch (Exception ex)
{
_logger.LogError("Image Provider - Error reading image tag for {0}", e, item.Path);
_logger.LogError(ex, "Image Provider - Error reading image tag for {0}", item.Path);
}
}

View File

@ -34,7 +34,7 @@ namespace Emby.Server.Implementations.Activity
}
catch (Exception ex)
{
Logger.LogError("Error loading database file. Will reset and retry.", ex);
Logger.LogError(ex, "Error loading database file. Will reset and retry.");
FileSystem.DeleteFile(DbFilePath);
@ -73,7 +73,7 @@ namespace Emby.Server.Implementations.Activity
}
catch (Exception ex)
{
Logger.LogError("Error migrating activity log database", ex);
Logger.LogError(ex, "Error migrating activity log database");
}
}
@ -87,36 +87,34 @@ namespace Emby.Server.Implementations.Activity
}
using (WriteLock.Write())
using (var connection = CreateConnection())
{
using (var connection = CreateConnection())
connection.RunInTransaction(db =>
{
connection.RunInTransaction(db =>
using (var statement = db.PrepareStatement("insert into ActivityLog (Name, Overview, ShortOverview, Type, ItemId, UserId, DateCreated, LogSeverity) values (@Name, @Overview, @ShortOverview, @Type, @ItemId, @UserId, @DateCreated, @LogSeverity)"))
{
using (var statement = db.PrepareStatement("insert into ActivityLog (Name, Overview, ShortOverview, Type, ItemId, UserId, DateCreated, LogSeverity) values (@Name, @Overview, @ShortOverview, @Type, @ItemId, @UserId, @DateCreated, @LogSeverity)"))
statement.TryBind("@Name", entry.Name);
statement.TryBind("@Overview", entry.Overview);
statement.TryBind("@ShortOverview", entry.ShortOverview);
statement.TryBind("@Type", entry.Type);
statement.TryBind("@ItemId", entry.ItemId);
if (entry.UserId.Equals(Guid.Empty))
{
statement.TryBind("@Name", entry.Name);
statement.TryBind("@Overview", entry.Overview);
statement.TryBind("@ShortOverview", entry.ShortOverview);
statement.TryBind("@Type", entry.Type);
statement.TryBind("@ItemId", entry.ItemId);
if (entry.UserId.Equals(Guid.Empty))
{
statement.TryBindNull("@UserId");
}
else
{
statement.TryBind("@UserId", entry.UserId.ToString("N"));
}
statement.TryBind("@DateCreated", entry.Date.ToDateTimeParamValue());
statement.TryBind("@LogSeverity", entry.Severity.ToString());
statement.MoveNext();
statement.TryBindNull("@UserId");
}
}, TransactionMode);
}
else
{
statement.TryBind("@UserId", entry.UserId.ToString("N"));
}
statement.TryBind("@DateCreated", entry.Date.ToDateTimeParamValue());
statement.TryBind("@LogSeverity", entry.Severity.ToString());
statement.MoveNext();
}
}, TransactionMode);
}
}
@ -128,132 +126,128 @@ namespace Emby.Server.Implementations.Activity
}
using (WriteLock.Write())
using (var connection = CreateConnection())
{
using (var connection = CreateConnection())
connection.RunInTransaction(db =>
{
connection.RunInTransaction(db =>
using (var statement = db.PrepareStatement("Update ActivityLog set Name=@Name,Overview=@Overview,ShortOverview=@ShortOverview,Type=@Type,ItemId=@ItemId,UserId=@UserId,DateCreated=@DateCreated,LogSeverity=@LogSeverity where Id=@Id"))
{
using (var statement = db.PrepareStatement("Update ActivityLog set Name=@Name,Overview=@Overview,ShortOverview=@ShortOverview,Type=@Type,ItemId=@ItemId,UserId=@UserId,DateCreated=@DateCreated,LogSeverity=@LogSeverity where Id=@Id"))
statement.TryBind("@Id", entry.Id);
statement.TryBind("@Name", entry.Name);
statement.TryBind("@Overview", entry.Overview);
statement.TryBind("@ShortOverview", entry.ShortOverview);
statement.TryBind("@Type", entry.Type);
statement.TryBind("@ItemId", entry.ItemId);
if (entry.UserId.Equals(Guid.Empty))
{
statement.TryBind("@Id", entry.Id);
statement.TryBind("@Name", entry.Name);
statement.TryBind("@Overview", entry.Overview);
statement.TryBind("@ShortOverview", entry.ShortOverview);
statement.TryBind("@Type", entry.Type);
statement.TryBind("@ItemId", entry.ItemId);
if (entry.UserId.Equals(Guid.Empty))
{
statement.TryBindNull("@UserId");
}
else
{
statement.TryBind("@UserId", entry.UserId.ToString("N"));
}
statement.TryBind("@DateCreated", entry.Date.ToDateTimeParamValue());
statement.TryBind("@LogSeverity", entry.Severity.ToString());
statement.MoveNext();
statement.TryBindNull("@UserId");
}
}, TransactionMode);
}
else
{
statement.TryBind("@UserId", entry.UserId.ToString("N"));
}
statement.TryBind("@DateCreated", entry.Date.ToDateTimeParamValue());
statement.TryBind("@LogSeverity", entry.Severity.ToString());
statement.MoveNext();
}
}, TransactionMode);
}
}
public QueryResult<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, bool? hasUserId, int? startIndex, int? limit)
{
using (WriteLock.Read())
using (var connection = CreateConnection(true))
{
using (var connection = CreateConnection(true))
var commandText = BaseActivitySelectText;
var whereClauses = new List<string>();
if (minDate.HasValue)
{
var commandText = BaseActivitySelectText;
var whereClauses = new List<string>();
if (minDate.HasValue)
whereClauses.Add("DateCreated>=@DateCreated");
}
if (hasUserId.HasValue)
{
if (hasUserId.Value)
{
whereClauses.Add("DateCreated>=@DateCreated");
whereClauses.Add("UserId not null");
}
if (hasUserId.HasValue)
else
{
if (hasUserId.Value)
{
whereClauses.Add("UserId not null");
}
else
{
whereClauses.Add("UserId is null");
}
whereClauses.Add("UserId is null");
}
}
var whereTextWithoutPaging = whereClauses.Count == 0 ?
string.Empty :
" where " + string.Join(" AND ", whereClauses.ToArray());
var whereTextWithoutPaging = whereClauses.Count == 0 ?
string.Empty :
" where " + string.Join(" AND ", whereClauses.ToArray(whereClauses.Count));
if (startIndex.HasValue && startIndex.Value > 0)
{
var pagingWhereText = whereClauses.Count == 0 ?
string.Empty :
" where " + string.Join(" AND ", whereClauses.ToArray());
whereClauses.Add(string.Format("Id NOT IN (SELECT Id FROM ActivityLog {0} ORDER BY DateCreated DESC LIMIT {1})",
pagingWhereText,
startIndex.Value.ToString(_usCulture)));
}
var whereText = whereClauses.Count == 0 ?
if (startIndex.HasValue && startIndex.Value > 0)
{
var pagingWhereText = whereClauses.Count == 0 ?
string.Empty :
" where " + string.Join(" AND ", whereClauses.ToArray());
commandText += whereText;
whereClauses.Add(string.Format("Id NOT IN (SELECT Id FROM ActivityLog {0} ORDER BY DateCreated DESC LIMIT {1})",
pagingWhereText,
startIndex.Value.ToString(_usCulture)));
}
commandText += " ORDER BY DateCreated DESC";
var whereText = whereClauses.Count == 0 ?
string.Empty :
" where " + string.Join(" AND ", whereClauses.ToArray(whereClauses.Count));
if (limit.HasValue)
commandText += whereText;
commandText += " ORDER BY DateCreated DESC";
if (limit.HasValue)
{
commandText += " LIMIT " + limit.Value.ToString(_usCulture);
}
var statementTexts = new List<string>();
statementTexts.Add(commandText);
statementTexts.Add("select count (Id) from ActivityLog" + whereTextWithoutPaging);
return connection.RunInTransaction(db =>
{
var list = new List<ActivityLogEntry>();
var result = new QueryResult<ActivityLogEntry>();
var statements = PrepareAllSafe(db, statementTexts).ToList();
using (var statement = statements[0])
{
commandText += " LIMIT " + limit.Value.ToString(_usCulture);
if (minDate.HasValue)
{
statement.TryBind("@DateCreated", minDate.Value.ToDateTimeParamValue());
}
foreach (var row in statement.ExecuteQuery())
{
list.Add(GetEntry(row));
}
}
var statementTexts = new List<string>();
statementTexts.Add(commandText);
statementTexts.Add("select count (Id) from ActivityLog" + whereTextWithoutPaging);
return connection.RunInTransaction(db =>
using (var statement = statements[1])
{
var list = new List<ActivityLogEntry>();
var result = new QueryResult<ActivityLogEntry>();
var statements = PrepareAllSafe(db, statementTexts).ToList();
using (var statement = statements[0])
if (minDate.HasValue)
{
if (minDate.HasValue)
{
statement.TryBind("@DateCreated", minDate.Value.ToDateTimeParamValue());
}
foreach (var row in statement.ExecuteQuery())
{
list.Add(GetEntry(row));
}
statement.TryBind("@DateCreated", minDate.Value.ToDateTimeParamValue());
}
using (var statement = statements[1])
{
if (minDate.HasValue)
{
statement.TryBind("@DateCreated", minDate.Value.ToDateTimeParamValue());
}
result.TotalRecordCount = statement.ExecuteQuery().SelectScalarInt().First();
}
result.TotalRecordCount = statement.ExecuteQuery().SelectScalarInt().First();
}
result.Items = list.ToArray(list.Count);
return result;
result.Items = list.ToArray();
return result;
}, ReadTransactionMode);
}
}, ReadTransactionMode);
}
}

View File

@ -259,7 +259,7 @@ namespace Emby.Server.Implementations.AppBase
}
catch (Exception ex)
{
Logger.LogError("Error loading configuration file: {0}", ex, path);
Logger.LogError(ex, "Error loading configuration file: {path}", path);
return Activator.CreateInstance(configurationType);
}

View File

@ -545,7 +545,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
Logger.LogError("Error creating {0}", ex, type.FullName);
Logger.LogError(ex, "Error creating {type}", type.FullName);
// Don't blow up in release mode
return null;
}
@ -625,7 +625,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
Logger.LogError("Error loading assembly {0}", ex, file);
Logger.LogError(ex, "Error loading assembly {file}", file);
return null;
}
}
@ -648,7 +648,7 @@ namespace Emby.Server.Implementations
/// <typeparam name="T"></typeparam>
/// <param name="manageLiftime">if set to <c>true</c> [manage liftime].</param>
/// <returns>IEnumerable{``0}.</returns>
public IEnumerable<T> GetExports<T>(bool manageLiftime = true)
public IEnumerable<T> GetExports<T>(bool manageLifetime = true)
{
var parts = GetExportTypes<T>()
.Select(CreateInstanceSafe)
@ -656,7 +656,7 @@ namespace Emby.Server.Implementations
.Cast<T>()
.ToList();
if (manageLiftime)
if (manageLifetime)
{
lock (DisposableParts)
{
@ -667,7 +667,7 @@ namespace Emby.Server.Implementations
return parts;
}
public List<Tuple<T, string>> GetExportsWithInfo<T>(bool manageLiftime = true)
public List<Tuple<T, string>> GetExportsWithInfo<T>(bool manageLifetime = true)
{
var parts = GetExportTypes<T>()
.Select(i =>
@ -683,7 +683,7 @@ namespace Emby.Server.Implementations
.Where(i => i != null)
.ToList();
if (manageLiftime)
if (manageLifetime)
{
lock (DisposableParts)
{
@ -693,6 +693,8 @@ namespace Emby.Server.Implementations
return parts;
}
// TODO: @bond
/*
private void SetBaseExceptionMessage()
{
@ -760,7 +762,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
Logger.LogError("Error in {0}", ex, name);
Logger.LogError(ex, "Error in {name}", name);
}
Logger.LogInformation("Entry point completed: {0}. Duration: {1} seconds", name, (DateTime.UtcNow - now).TotalSeconds.ToString(CultureInfo.InvariantCulture), "ImageInfos");
}
@ -777,7 +779,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
Logger.LogError("Error configuring autorun", ex);
Logger.LogError(ex, "Error configuring autorun");
}
}
@ -1119,7 +1121,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
Logger.LogError("Error setting http limit", ex);
Logger.LogError(ex, "Error setting http limit");
}
}
@ -1186,7 +1188,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
Logger.LogError("Error loading cert from {0}", ex, certificateLocation);
Logger.LogError(ex, "Error loading cert from {certificateLocation}", certificateLocation);
return null;
}
}
@ -1415,7 +1417,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
Logger.LogError("Error getting plugin Id from {0}.", ex, plugin.GetType().FullName);
Logger.LogError(ex, "Error getting plugin Id from {pluginName}.", plugin.GetType().FullName);
}
}
@ -1427,7 +1429,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
Logger.LogError("Error loading plugin {0}", ex, plugin.GetType().FullName);
Logger.LogError(ex, "Error loading plugin {pluginName}", plugin.GetType().FullName);
return null;
}
@ -1450,11 +1452,11 @@ namespace Emby.Server.Implementations
if (path == null)
{
Logger.LogInformation("Loading {0}", assembly.FullName);
Logger.LogInformation("Loading {assemblyName}", assembly.FullName);
}
else
{
Logger.LogInformation("Loading {0} from {1}", assembly.FullName, path);
Logger.LogInformation("Loading {assemblyName} from {path}", assembly.FullName, path);
}
}
@ -1507,7 +1509,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
Logger.LogError("Error loading types from assembly", ex);
Logger.LogError(ex, "Error loading types from assembly");
return new List<Tuple<Type, string>>();
}
@ -1554,7 +1556,7 @@ namespace Emby.Server.Implementations
? "The http server is unable to start due to a Socket error. This can occasionally happen when the operating system takes longer than usual to release the IP bindings from the previous session. This can take up to five minutes. Please try waiting or rebooting the system."
: "Error starting Http Server";
Logger.LogError(msg, ex);
Logger.LogError(ex, msg);
if (HttpPort == ServerConfiguration.DefaultHttpPort)
{
@ -1570,7 +1572,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
Logger.LogError("Error starting http server", ex);
Logger.LogError(ex, "Error starting http server");
throw;
}
@ -1605,7 +1607,7 @@ namespace Emby.Server.Implementations
// }
// catch (Exception ex)
// {
// Logger.LogError("Error creating ssl cert", ex);
// Logger.LogError(ex, "Error creating ssl cert");
// return null;
// }
// }
@ -1710,7 +1712,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
Logger.LogError("Error sending server restart notification", ex);
Logger.LogError(ex, "Error sending server restart notification");
}
Logger.LogInformation("Calling RestartInternal");
@ -1845,7 +1847,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
Logger.LogError("Error getting version number from {0}", ex, path);
Logger.LogError(ex, "Error getting version number from {path}", path);
return new Version(1, 0);
}
@ -1930,13 +1932,13 @@ namespace Emby.Server.Implementations
if (version < minRequiredVersion)
{
Logger.LogInformation("Not loading {0} {1} because the minimum supported version is {2}. Please update to the newer version", filename, version, minRequiredVersion);
Logger.LogInformation("Not loading {filename} {version} because the minimum supported version is {minRequiredVersion}. Please update to the newer version", filename, version, minRequiredVersion);
return false;
}
}
catch (Exception ex)
{
Logger.LogError("Error getting version number from {0}", ex, path);
Logger.LogError(ex, "Error getting version number from {path}", path);
return false;
}
@ -2043,7 +2045,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
Logger.LogError("Error getting local Ip address information", ex);
Logger.LogError(ex, "Error getting local Ip address information");
}
return null;
@ -2251,7 +2253,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
Logger.LogError("Error sending server shutdown notification", ex);
Logger.LogError(ex, "Error sending server shutdown notification");
}
ShutdownInternal();
@ -2276,7 +2278,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
Logger.LogError("Error authorizing server", ex);
Logger.LogError(ex, "Error authorizing server");
}
}
@ -2443,9 +2445,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
Console.WriteLine("Error launching url: {0}", url);
Logger.LogError("Error launching url: {0}", ex, url);
Logger.LogError(ex, "Error launching url: {url}", url);
throw;
}
}
@ -2516,7 +2516,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
Logger.LogError("Error disposing {0}", ex, part.GetType().Name);
Logger.LogError(ex, "Error disposing {0}", part.GetType().Name);
}
}
}

View File

@ -300,7 +300,7 @@ namespace Emby.Server.Implementations.Channels
}
catch (Exception ex)
{
_logger.LogError("Error getting channel information for {0}", ex, channelInfo.Name);
_logger.LogError(ex, "Error getting channel information for {0}", channelInfo.Name);
}
numComplete++;
@ -848,7 +848,7 @@ namespace Emby.Server.Implementations.Channels
}
catch (Exception ex)
{
_logger.LogError("Error writing to channel cache file: {0}", ex, path);
_logger.LogError(ex, "Error writing to channel cache file: {path}", path);
}
}
@ -911,7 +911,7 @@ namespace Emby.Server.Implementations.Channels
}
catch (Exception ex)
{
_logger.LogError("Error retrieving channel item from database", ex);
_logger.LogError(ex, "Error retrieving channel item from database");
}
if (item == null)

View File

@ -365,7 +365,7 @@ namespace Emby.Server.Implementations.Collections
}
catch (Exception ex)
{
_logger.LogError("Error creating camera uploads library", ex);
_logger.LogError(ex, "Error creating camera uploads library");
}
_config.Configuration.CollectionsUpgraded = true;

View File

@ -323,7 +323,7 @@ namespace Emby.Server.Implementations.Data
}
catch (Exception ex)
{
Logger.LogError("Error disposing database", ex);
Logger.LogError(ex, "Error disposing database");
}
}

View File

@ -53,7 +53,7 @@ namespace Emby.Server.Implementations.Data
}
catch (Exception ex)
{
Logger.LogError("Error loading database file. Will reset and retry.", ex);
Logger.LogError(ex, "Error loading database file. Will reset and retry.");
FileSystem.DeleteFile(DbFilePath);

View File

@ -1364,7 +1364,7 @@ namespace Emby.Server.Implementations.Data
}
catch (SerializationException ex)
{
Logger.LogError("Error deserializing item", ex);
Logger.LogError(ex, "Error deserializing item");
}
}
}

View File

@ -74,7 +74,7 @@ namespace Emby.Server.Implementations.Data
}
catch (Exception ex)
{
Logger.LogError("Error migrating users database", ex);
Logger.LogError(ex, "Error migrating users database");
}
}

View File

@ -45,7 +45,7 @@ namespace Emby.Server.Implementations.Devices
}
catch (Exception ex)
{
_logger.LogError("Error reading file", ex);
_logger.LogError(ex, "Error reading file");
}
return null;
@ -66,7 +66,7 @@ namespace Emby.Server.Implementations.Devices
}
catch (Exception ex)
{
_logger.LogError("Error writing to file", ex);
_logger.LogError(ex, "Error writing to file");
}
}

View File

@ -434,7 +434,7 @@ namespace Emby.Server.Implementations.Devices
}
catch (Exception ex)
{
_logger.LogError("Error creating camera uploads library", ex);
_logger.LogError(ex, "Error creating camera uploads library");
}
_config.Configuration.CameraUploadUpgraded = true;

View File

@ -225,7 +225,7 @@ namespace Emby.Server.Implementations.Dto
catch (Exception ex)
{
// Have to use a catch-all unfortunately because some .net image methods throw plain Exceptions
_logger.LogError("Error generating PrimaryImageAspectRatio for {0}", ex, item.Name);
_logger.LogError(ex, "Error generating PrimaryImageAspectRatio for {itemName}", item.Name);
}
}
@ -547,7 +547,7 @@ namespace Emby.Server.Implementations.Dto
}
catch (Exception ex)
{
_logger.LogError("Error getting {0} image info", ex, type);
_logger.LogError(ex, "Error getting {type} image info", type);
return null;
}
}
@ -560,7 +560,7 @@ namespace Emby.Server.Implementations.Dto
}
catch (Exception ex)
{
_logger.LogError("Error getting {0} image info for {1}", ex, image.Type, image.Path);
_logger.LogError(ex, "Error getting {imageType} image info for {path}", image.Type, image.Path);
return null;
}
}
@ -619,7 +619,7 @@ namespace Emby.Server.Implementations.Dto
}
catch (Exception ex)
{
_logger.LogError("Error getting person {0}", ex, c);
_logger.LogError(ex, "Error getting person {0}", c);
return null;
}
@ -1451,7 +1451,7 @@ namespace Emby.Server.Implementations.Dto
}
catch (Exception ex)
{
//_logger.LogError("Failed to determine primary image aspect ratio for {0}", ex, imageInfo.Path);
_logger.LogError(ex, "Failed to determine primary image aspect ratio for {0}", imageInfo.Path);
return null;
}
}
@ -1464,7 +1464,7 @@ namespace Emby.Server.Implementations.Dto
}
catch (Exception ex)
{
_logger.LogError("Error in image enhancer: {0}", ex, enhancer.GetType().Name);
_logger.LogError(ex, "Error in image enhancer: {0}", enhancer.GetType().Name);
}
}

View File

@ -73,7 +73,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
catch (Exception ex)
{
_logger.LogError("Error restarting server", ex);
_logger.LogError(ex, "Error restarting server");
}
}
}
@ -98,7 +98,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
catch (Exception ex)
{
_logger.LogError("Error getting timers", ex);
_logger.LogError(ex, "Error getting timers");
}
}

View File

@ -216,7 +216,7 @@ namespace Emby.Server.Implementations.EntryPoints
catch
{
// Commenting out because users are reporting problems out of our control
//_logger.LogError("Error creating port forwarding rules", ex);
//_logger.LogError(ex, "Error creating port forwarding rules");
}
}
@ -253,6 +253,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
catch (Exception ex)
{
_logger.LogError(ex, "Error creating http port map");
return;
}
@ -262,6 +263,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
catch (Exception ex)
{
_logger.LogError(ex, "Error creating https port map");
}
}
@ -309,7 +311,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
catch (Exception ex)
{
_logger.LogError("Error stopping NAT Discovery", ex);
_logger.LogError(ex, "Error stopping NAT Discovery");
}
}
}

View File

@ -49,7 +49,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
catch (Exception ex)
{
_logger.LogError("Error resetting system standby timer", ex);
_logger.LogError(ex, "Error resetting system standby timer");
}
}

View File

@ -331,7 +331,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
catch (Exception ex)
{
_logger.LogError("Error in GetLibraryUpdateInfo", ex);
_logger.LogError(ex, "Error in GetLibraryUpdateInfo");
return;
}
@ -346,7 +346,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
catch (Exception ex)
{
_logger.LogError("Error sending LibraryChanged message", ex);
_logger.LogError(ex, "Error sending LibraryChanged message");
}
}
}

View File

@ -66,7 +66,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
catch (Exception ex)
{
_logger.LogError("Error sending message", ex);
_logger.LogError(ex, "Error sending message");
}
}

View File

@ -156,14 +156,10 @@ namespace Emby.Server.Implementations.EntryPoints
try
{
await _sessionManager.SendMessageToAdminSessions(name, data, CancellationToken.None);
}
catch (ObjectDisposedException)
{
}
catch (Exception)
{
//Logger.LogError("Error sending message", ex);
}
}
@ -172,14 +168,10 @@ namespace Emby.Server.Implementations.EntryPoints
try
{
await _sessionManager.SendMessageToUserSessions(new List<Guid> { user.Id }, name, data, CancellationToken.None);
}
catch (ObjectDisposedException)
{
}
catch (Exception)
{
//Logger.LogError("Error sending message", ex);
}
}

View File

@ -58,7 +58,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
catch (Exception ex)
{
_logger.LogError("Failed to start UDP Server", ex);
_logger.LogError(ex, "Failed to start UDP Server");
}
}

View File

@ -91,7 +91,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
catch (Exception ex)
{
//_logger.LogError("Error sending anonymous usage statistics.", ex);
_logger.LogError(ex, "Error sending anonymous usage statistics.");
}
}
@ -119,7 +119,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
catch (Exception ex)
{
//_logger.LogError("Error sending anonymous usage statistics.", ex);
_logger.LogError(ex, "Error sending anonymous usage statistics.");
}
}

View File

@ -685,7 +685,7 @@ namespace Emby.Server.Implementations.HttpClientManager
{
if (options.LogErrors)
{
_logger.LogError("Error " + webException.Status + " getting response from " + options.Url, webException);
_logger.LogError(webException, "Error {status} getting response from {url}", webException.Status, options.Url);
}
var exception = new HttpException(webException.Message, webException);
@ -723,7 +723,7 @@ namespace Emby.Server.Implementations.HttpClientManager
if (options.LogErrors)
{
_logger.LogError("Error getting response from " + options.Url, ex);
_logger.LogError(ex, "Error getting response from {url}", options.Url);
}
return ex;

View File

@ -252,7 +252,7 @@ namespace Emby.Server.Implementations.HttpServer
if (logExceptionStackTrace)
{
_logger.LogError("Error processing request", ex);
_logger.LogError(ex, "Error processing request");
}
else if (logExceptionMessage)
{
@ -272,9 +272,9 @@ namespace Emby.Server.Implementations.HttpServer
httpRes.ContentType = "text/html";
await Write(httpRes, NormalizeExceptionMessage(ex.Message)).ConfigureAwait(false);
}
catch
catch (Exception errorEx)
{
//_logger.LogError("Error this.ProcessRequest(context)(Exception while writing error to the response)", errorEx);
_logger.LogError(errorEx, "Error this.ProcessRequest(context)(Exception while writing error to the response)");
}
}
@ -713,7 +713,7 @@ namespace Emby.Server.Implementations.HttpServer
var pathParts = pathInfo.TrimStart('/').Split('/');
if (pathParts.Length == 0)
{
_logger.LogError("Path parts empty for PathInfo: {0}, Url: {1}", pathInfo, httpReq.RawUrl);
_logger.LogError("Path parts empty for PathInfo: {pathInfo}, Url: {RawUrl}", pathInfo, httpReq.RawUrl);
return null;
}
@ -729,7 +729,7 @@ namespace Emby.Server.Implementations.HttpServer
};
}
_logger.LogError("Could not find handler for {0}", pathInfo);
_logger.LogError("Could not find handler for {pathInfo}", pathInfo);
return null;
}
@ -919,7 +919,7 @@ namespace Emby.Server.Implementations.HttpServer
return Task.CompletedTask;
}
//_logger.LogDebug("Websocket message received: {0}", result.MessageType);
_logger.LogDebug("Websocket message received: {0}", result.MessageType);
var tasks = _webSocketListeners.Select(i => Task.Run(async () =>
{
@ -929,7 +929,7 @@ namespace Emby.Server.Implementations.HttpServer
}
catch (Exception ex)
{
_logger.LogError("{0} failed processing WebSocket message {1}", ex, i.GetType().Name, result.MessageType ?? string.Empty);
_logger.LogError(ex, "{0} failed processing WebSocket message {1}", i.GetType().Name, result.MessageType ?? string.Empty);
}
}));

View File

@ -34,7 +34,7 @@ namespace Emby.Server.Implementations.HttpServer
if (exception != null)
{
_logger.LogError("Error processing request for {0}", exception, req.RawUrl);
_logger.LogError(exception, "Error processing request for {RawUrl}", req.RawUrl);
if (!string.IsNullOrEmpty(exception.Message))
{

View File

@ -180,7 +180,7 @@ namespace Emby.Server.Implementations.HttpServer
if (!message.StartsWith("{", StringComparison.OrdinalIgnoreCase))
{
// This info is useful sometimes but also clogs up the log
//_lLogError("Received web socket message that is not a json structure: " + message);
_logger.LogDebug("Received web socket message that is not a json structure: {message}", message);
return;
}
@ -204,7 +204,7 @@ namespace Emby.Server.Implementations.HttpServer
}
catch (Exception ex)
{
_logger.LogError("Error processing web socket message", ex);
_logger.LogError(ex, "Error processing web socket message");
}
}

View File

@ -141,7 +141,7 @@ namespace Emby.Server.Implementations.IO
}
catch (Exception ex)
{
Logger.LogError("Error processing directory changes", ex);
Logger.LogError(ex, "Error processing directory changes");
}
}
@ -161,7 +161,7 @@ namespace Emby.Server.Implementations.IO
continue;
}
Logger.LogInformation(item.Name + " (" + item.Path + ") will be refreshed.");
Logger.LogInformation("{name} ({path}}) will be refreshed.", item.Name, item.Path);
try
{
@ -172,11 +172,11 @@ namespace Emby.Server.Implementations.IO
// For now swallow and log.
// Research item: If an IOException occurs, the item may be in a disconnected state (media unavailable)
// Should we remove it from it's parent?
Logger.LogError("Error refreshing {0}", ex, item.Name);
Logger.LogError(ex, "Error refreshing {name}", item.Name);
}
catch (Exception ex)
{
Logger.LogError("Error refreshing {0}", ex, item.Name);
Logger.LogError(ex, "Error refreshing {name}", item.Name);
}
}
}

View File

@ -114,7 +114,7 @@ namespace Emby.Server.Implementations.IO
}
catch (Exception ex)
{
Logger.LogError("Error in ReportFileSystemChanged for {0}", ex, path);
Logger.LogError(ex, "Error in ReportFileSystemChanged for {path}", path);
}
}
}
@ -354,7 +354,7 @@ namespace Emby.Server.Implementations.IO
}
catch (Exception ex)
{
Logger.LogError("Error watching path: {0}", ex, path);
Logger.LogError(ex, "Error watching path: {path}", path);
}
});
}
@ -382,7 +382,7 @@ namespace Emby.Server.Implementations.IO
{
using (watcher)
{
Logger.LogInformation("Stopping directory watching for path {0}", watcher.Path);
Logger.LogInformation("Stopping directory watching for path {path}", watcher.Path);
watcher.Created -= watcher_Changed;
watcher.Deleted -= watcher_Changed;
@ -439,7 +439,7 @@ namespace Emby.Server.Implementations.IO
var ex = e.GetException();
var dw = (FileSystemWatcher)sender;
Logger.LogError("Error in Directory watcher for: " + dw.Path, ex);
Logger.LogError(ex, "Error in Directory watcher for: {path}", dw.Path);
DisposeWatcher(dw, true);
}
@ -461,7 +461,7 @@ namespace Emby.Server.Implementations.IO
}
catch (Exception ex)
{
Logger.LogError("Exception in ReportFileSystemChanged. Path: {0}", ex, e.FullPath);
Logger.LogError(ex, "Exception in ReportFileSystemChanged. Path: {FullPath}", e.FullPath);
}
}
@ -487,13 +487,13 @@ namespace Emby.Server.Implementations.IO
{
if (_fileSystem.AreEqual(i, path))
{
//logger.LogDebug("Ignoring change to {0}", path);
Logger.LogDebug("Ignoring change to {path}", path);
return true;
}
if (_fileSystem.ContainsSubPath(i, path))
{
//logger.LogDebug("Ignoring change to {0}", path);
Logger.LogDebug("Ignoring change to {path}", path);
return true;
}
@ -503,7 +503,7 @@ namespace Emby.Server.Implementations.IO
{
if (_fileSystem.AreEqual(parent, path))
{
//logger.LogDebug("Ignoring change to {0}", path);
Logger.LogDebug("Ignoring change to {path}", path);
return true;
}
}

View File

@ -175,7 +175,7 @@ namespace Emby.Server.Implementations.IO
path = System.IO.Path.GetFullPath(path);
return path;
}
catch (ArgumentException ex)
catch (ArgumentException)
{
return filePath;
}
@ -395,7 +395,7 @@ namespace Emby.Server.Implementations.IO
}
catch (Exception ex)
{
Logger.LogError("Error determining CreationTimeUtc for {0}", ex, info.FullName);
Logger.LogError(ex, "Error determining CreationTimeUtc for {FullName}", info.FullName);
return DateTime.MinValue;
}
}
@ -434,7 +434,7 @@ namespace Emby.Server.Implementations.IO
}
catch (Exception ex)
{
Logger.LogError("Error determining LastAccessTimeUtc for {0}", ex, info.FullName);
Logger.LogError(ex, "Error determining LastAccessTimeUtc for {FullName}", info.FullName);
return DateTime.MinValue;
}
}

View File

@ -384,7 +384,7 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
_logger.LogError("Error deleting {0}", ex, metadataPath);
_logger.LogError(ex, "Error deleting {metadataPath}", metadataPath);
}
}
@ -398,14 +398,13 @@ namespace Emby.Server.Implementations.Library
{
try
{
_logger.LogDebug("Deleting path {path}", fileSystemInfo.FullName);
if (fileSystemInfo.IsDirectory)
{
_logger.LogDebug("Deleting path {0}", fileSystemInfo.FullName);
_fileSystem.DeleteDirectory(fileSystemInfo.FullName, true);
}
else
{
_logger.LogDebug("Deleting path {0}", fileSystemInfo.FullName);
_fileSystem.DeleteFile(fileSystemInfo.FullName);
}
}
@ -489,7 +488,7 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
_logger.LogError("Error in {0} resolving {1}", ex, resolver.GetType().Name, args.Path);
_logger.LogError(ex, "Error in {resolver} resolving {path}", resolver.GetType().Name, args.Path);
return null;
}
}
@ -587,7 +586,7 @@ namespace Emby.Server.Implementations.Library
{
if (parent != null && parent.IsPhysicalRoot)
{
_logger.LogError("Error in GetFilteredFileSystemEntries isPhysicalRoot: {0} IsVf: {1}", ex, isPhysicalRoot, isVf);
_logger.LogError(ex, "Error in GetFilteredFileSystemEntries isPhysicalRoot: {0} IsVf: {1}", isPhysicalRoot, isVf);
files = new FileSystemMetadata[] { };
}
@ -713,7 +712,7 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
_logger.LogError("Error resolving path {0}", ex, f.FullName);
_logger.LogError(ex, "Error resolving path {path}", f.FullName);
return null;
}
}).Where(i => i != null);
@ -1148,7 +1147,7 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
_logger.LogError("Error running postscan task", ex);
_logger.LogError(ex, "Error running postscan task");
}
numComplete++;
@ -1199,7 +1198,7 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
_logger.LogError("Error resolving shortcut file {0}", ex, i);
_logger.LogError(ex, "Error resolving shortcut file {file}", i);
return null;
}
})
@ -1650,7 +1649,7 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
_logger.LogError("Error getting intros", ex);
_logger.LogError(ex, "Error getting intros");
return new List<IntroInfo>();
}
@ -1670,7 +1669,7 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
_logger.LogError("Error getting intro files", ex);
_logger.LogError(ex, "Error getting intro files");
return new List<string>();
}
@ -1693,7 +1692,7 @@ namespace Emby.Server.Implementations.Library
if (video == null)
{
_logger.LogError("Unable to locate item with Id {0}.", info.ItemId.Value);
_logger.LogError("Unable to locate item with Id {ID}.", info.ItemId.Value);
}
}
else if (!string.IsNullOrEmpty(info.Path))
@ -1705,7 +1704,7 @@ namespace Emby.Server.Implementations.Library
if (video == null)
{
_logger.LogError("Intro resolver returned null for {0}.", info.Path);
_logger.LogError("Intro resolver returned null for {path}.", info.Path);
}
else
{
@ -1724,7 +1723,7 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
_logger.LogError("Error resolving path {0}.", ex, info.Path);
_logger.LogError(ex, "Error resolving path {path}.", info.Path);
}
}
else
@ -1873,7 +1872,7 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
_logger.LogError("Error in ItemAdded event handler", ex);
_logger.LogError(ex, "Error in ItemAdded event handler");
}
}
}
@ -1929,7 +1928,7 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
_logger.LogError("Error in ItemUpdated event handler", ex);
_logger.LogError(ex, "Error in ItemUpdated event handler");
}
}
}
@ -1965,7 +1964,7 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
_logger.LogError("Error in ItemRemoved event handler", ex);
_logger.LogError(ex, "Error in ItemRemoved event handler");
}
}
}
@ -2808,7 +2807,7 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
_logger.LogError("Error getting person", ex);
_logger.LogError(ex, "Error getting person");
return null;
}

View File

@ -256,7 +256,7 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
_logger.LogError("Error getting media sources", ex);
_logger.LogError(ex, "Error getting media sources");
return new List<MediaSourceInfo>();
}
}
@ -477,7 +477,7 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
_logger.LogError("Error probing live tv stream", ex);
_logger.LogError(ex, "Error probing live tv stream");
AddMediaInfo(mediaSource, isAudio);
}

View File

@ -392,7 +392,7 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
_logger.LogError("Error authenticating with provider {0}", ex, provider.Name);
_logger.LogError(ex, "Error authenticating with provider {provider}", provider.Name);
return false;
}
@ -575,7 +575,7 @@ namespace Emby.Server.Implementations.Library
catch (Exception ex)
{
// Have to use a catch-all unfortunately because some .net image methods throw plain Exceptions
_logger.LogError("Error generating PrimaryImageAspectRatio for {0}", ex, user.Name);
_logger.LogError(ex, "Error generating PrimaryImageAspectRatio for {user}", user.Name);
}
}
@ -599,7 +599,7 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
_logger.LogError("Error getting {0} image info for {1}", ex, image.Type, image.Path);
_logger.LogError(ex, "Error getting {imageType} image info for {imagePath}", image.Type, image.Path);
return null;
}
}
@ -775,7 +775,7 @@ namespace Emby.Server.Implementations.Library
}
catch (IOException ex)
{
_logger.LogError("Error deleting file {0}", ex, configPath);
_logger.LogError(ex, "Error deleting file {path}", configPath);
}
DeleteUserPolicy(user);
@ -1045,7 +1045,7 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
_logger.LogError("Error reading policy file: {0}", ex, path);
_logger.LogError(ex, "Error reading policy file: {path}", path);
return GetDefaultPolicy(user);
}
@ -1109,7 +1109,7 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
_logger.LogError("Error deleting policy file", ex);
_logger.LogError(ex, "Error deleting policy file");
}
}
@ -1144,7 +1144,7 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
_logger.LogError("Error reading policy file: {0}", ex, path);
_logger.LogError(ex, "Error reading policy file: {path}", path);
return new UserConfiguration();
}

View File

@ -70,7 +70,7 @@ namespace Emby.Server.Implementations.Library.Validators
}
catch (Exception ex)
{
_logger.LogError("Error refreshing {0}", ex, name);
_logger.LogError(ex, "Error refreshing {ArtistName}", name);
}
numComplete++;

View File

@ -57,7 +57,7 @@ namespace Emby.Server.Implementations.Library.Validators
}
catch (Exception ex)
{
_logger.LogError("Error refreshing {0}", ex, name);
_logger.LogError(ex, "Error refreshing {GenreName}", name);
}
numComplete++;

View File

@ -58,7 +58,7 @@ namespace Emby.Server.Implementations.Library.Validators
}
catch (Exception ex)
{
_logger.LogError("Error refreshing {0}", ex, name);
_logger.LogError(ex, "Error refreshing {GenreName}", name);
}
numComplete++;

View File

@ -58,7 +58,7 @@ namespace Emby.Server.Implementations.Library.Validators
}
catch (Exception ex)
{
_logger.LogError("Error refreshing {0}", ex, name);
_logger.LogError(ex, "Error refreshing {GenreName}", name);
}
numComplete++;

View File

@ -78,7 +78,7 @@ namespace Emby.Server.Implementations.Library.Validators
}
catch (Exception ex)
{
_logger.LogError("Error validating IBN entry {0}", ex, person);
_logger.LogError(ex, "Error validating IBN entry {person}", person);
}
// Update progress

View File

@ -57,7 +57,7 @@ namespace Emby.Server.Implementations.Library.Validators
}
catch (Exception ex)
{
_logger.LogError("Error refreshing {0}", ex, name);
_logger.LogError(ex, "Error refreshing {StudioName}", name);
}
numComplete++;

View File

@ -170,7 +170,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
_logger.LogError("Error creating virtual folder", ex);
_logger.LogError(ex, "Error creating virtual folder");
}
pathsAdded.AddRange(pathsToCreate);
@ -196,7 +196,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
_logger.LogError("Error creating recording folders", ex);
_logger.LogError(ex, "Error creating recording folders");
}
}
@ -224,7 +224,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
_logger.LogError("Error removing virtual folder", ex);
_logger.LogError(ex, "Error removing virtual folder");
}
}
else
@ -236,14 +236,14 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
_logger.LogError("Error removing media path", ex);
_logger.LogError(ex, "Error removing media path");
}
}
}
if (requiresRefresh)
{
_libraryManager.ValidateMediaLibrary(new SimpleProgress<Double>(), CancellationToken.None);
await _libraryManager.ValidateMediaLibrary(new SimpleProgress<Double>(), CancellationToken.None);
}
}
@ -342,7 +342,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
_logger.LogError("Error getting channels", ex);
_logger.LogError(ex, "Error getting channels");
}
}
@ -364,7 +364,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
_logger.LogError("Error adding metadata", ex);
_logger.LogError(ex, "Error adding metadata");
}
}
}
@ -595,7 +595,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
_logger.LogError("Error getting channels", ex);
_logger.LogError(ex, "Error getting channels");
}
}
@ -1217,7 +1217,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
_logger.LogError("Error recording stream", ex);
_logger.LogError(ex, "Error recording stream");
}
}
@ -1414,16 +1414,16 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
await recorder.Record(directStreamProvider, mediaStreamInfo, recordPath, duration, onStarted, activeRecordingInfo.CancellationTokenSource.Token).ConfigureAwait(false);
recordingStatus = RecordingStatus.Completed;
_logger.LogInformation("Recording completed: {0}", recordPath);
_logger.LogInformation("Recording completed: {recordPath}", recordPath);
}
catch (OperationCanceledException)
{
_logger.LogInformation("Recording stopped: {0}", recordPath);
_logger.LogInformation("Recording stopped: {recordPath}", recordPath);
recordingStatus = RecordingStatus.Completed;
}
catch (Exception ex)
{
_logger.LogError("Error recording to {0}", ex, recordPath);
_logger.LogError(ex, "Error recording to {recordPath}", recordPath);
recordingStatus = RecordingStatus.Error;
}
@ -1435,7 +1435,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
_logger.LogError("Error closing live stream", ex);
_logger.LogError(ex, "Error closing live stream");
}
}
@ -1511,20 +1511,20 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
_logger.LogError("Error deleting 0-byte failed recording file {0}", ex, path);
_logger.LogError(ex, "Error deleting 0-byte failed recording file {path}", path);
}
}
}
private void TriggerRefresh(string path)
{
_logger.LogInformation("Triggering refresh on {0}", path);
_logger.LogInformation("Triggering refresh on {path}", path);
var item = GetAffectedBaseItem(_fileSystem.GetDirectoryName(path));
if (item != null)
{
_logger.LogInformation("Refreshing recording parent {0}", item.Path);
_logger.LogInformation("Refreshing recording parent {path}", item.Path);
_providerManager.QueueRefresh(item.Id, new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem))
{
@ -1642,7 +1642,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
_logger.LogError("Error deleting item", ex);
_logger.LogError(ex, "Error deleting item");
}
}
}
@ -1668,7 +1668,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
_logger.LogError("Error deleting recording", ex);
_logger.LogError(ex, "Error deleting recording");
}
}
}
@ -1780,7 +1780,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
_logger.LogError("Error running recording post processor", ex);
_logger.LogError(ex, "Error running recording post processor");
}
}
@ -1794,7 +1794,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
var process = (IProcess)sender;
try
{
_logger.LogInformation("Recording post-processing script completed with exit code {0}", process.ExitCode);
_logger.LogInformation("Recording post-processing script completed with exit code {ExitCode}", process.ExitCode);
}
catch
{
@ -1875,7 +1875,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
_logger.LogError("Error saving recording image", ex);
_logger.LogError(ex, "Error saving recording image");
}
}
@ -1890,7 +1890,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
_logger.LogError("Error saving recording image", ex);
_logger.LogError(ex, "Error saving recording image");
}
}
@ -1903,7 +1903,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
_logger.LogError("Error saving recording image", ex);
_logger.LogError(ex, "Error saving recording image");
}
}
@ -1916,7 +1916,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
_logger.LogError("Error saving recording image", ex);
_logger.LogError(ex, "Error saving recording image");
}
}
}
@ -1984,7 +1984,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
_logger.LogError("Error saving nfo", ex);
_logger.LogError(ex, "Error saving nfo");
}
}
@ -2814,7 +2814,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
_logger.LogError("Error discovering tuner devices", ex);
_logger.LogError(ex, "Error discovering tuner devices");
return new List<TunerHostInfo>();
}

View File

@ -269,14 +269,14 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
try
{
_logger.LogInformation("Stopping ffmpeg recording process for {0}", _targetPath);
_logger.LogInformation("Stopping ffmpeg recording process for {path}", _targetPath);
//process.Kill();
_process.StandardInput.WriteLine("q");
}
catch (Exception ex)
{
_logger.LogError("Error stopping recording transcoding job for {0}", ex, _targetPath);
_logger.LogError(ex, "Error stopping recording transcoding job for {path}", _targetPath);
}
if (_hasExited)
@ -286,7 +286,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
try
{
_logger.LogInformation("Calling recording process.WaitForExit for {0}", _targetPath);
_logger.LogInformation("Calling recording process.WaitForExit for {path}", _targetPath);
if (_process.WaitForExit(10000))
{
@ -295,7 +295,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
_logger.LogError("Error waiting for recording process to exit for {0}", ex, _targetPath);
_logger.LogError(ex, "Error waiting for recording process to exit for {path}", _targetPath);
}
if (_hasExited)
@ -305,13 +305,13 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
try
{
_logger.LogInformation("Killing ffmpeg recording process for {0}", _targetPath);
_logger.LogInformation("Killing ffmpeg recording process for {path}", _targetPath);
_process.Kill();
}
catch (Exception ex)
{
_logger.LogError("Error killing recording transcoding job for {0}", ex, _targetPath);
_logger.LogError(ex, "Error killing recording transcoding job for {path}", _targetPath);
}
}
}
@ -329,7 +329,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
var exitCode = process.ExitCode;
_logger.LogInformation("FFMpeg recording exited with code {0} for {1}", exitCode, _targetPath);
_logger.LogInformation("FFMpeg recording exited with code {ExitCode} for {path}", exitCode, _targetPath);
if (exitCode == 0)
{
@ -337,13 +337,13 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
else
{
_taskCompletionSource.TrySetException(new Exception(string.Format("Recording for {0} failed. Exit code {1}", _targetPath, exitCode)));
_taskCompletionSource.TrySetException(new Exception(string.Format("Recording for {path} failed. Exit code {ExitCode}", _targetPath, exitCode)));
}
}
catch
{
_logger.LogError("FFMpeg recording exited with an error for {0}.", _targetPath);
_taskCompletionSource.TrySetException(new Exception(string.Format("Recording for {0} failed", _targetPath)));
_logger.LogError("FFMpeg recording exited with an error for {path}.", _targetPath);
_taskCompletionSource.TrySetException(new Exception(string.Format("Recording for {path} failed", _targetPath)));
}
}
@ -357,7 +357,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
_logger.LogError("Error disposing recording log stream", ex);
_logger.LogError(ex, "Error disposing recording log stream");
}
_logFileStream = null;
@ -387,7 +387,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
_logger.LogError("Error reading ffmpeg recording log", ex);
_logger.LogError(ex, "Error reading ffmpeg recording log");
}
}
}

View File

@ -59,7 +59,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
Logger.LogError("Error deserializing {0}", ex, jsonFile);
Logger.LogError(ex, "Error deserializing {jsonFile}", jsonFile);
}
return new List<T>();
}

View File

@ -143,7 +143,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
_logger.LogError("Error scheduling wake timer", ex);
_logger.LogError(ex, "Error scheduling wake timer");
}
}
@ -153,12 +153,12 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
if (_timers.TryAdd(item.Id, timer))
{
_logger.LogInformation("Creating recording timer for {0}, {1}. Timer will fire in {2} minutes", item.Id, item.Name, dueTime.TotalMinutes.ToString(CultureInfo.InvariantCulture));
_logger.LogInformation("Creating recording timer for {id}, {name}. Timer will fire in {minutes} minutes", item.Id, item.Name, dueTime.TotalMinutes.ToString(CultureInfo.InvariantCulture));
}
else
{
timer.Dispose();
_logger.LogWarning("Timer already exists for item {0}", item.Id);
_logger.LogWarning("Timer already exists for item {id}", item.Id);
}
}

View File

@ -527,7 +527,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
}
catch (Exception ex)
{
_logger.LogError("Error getting image info from schedules direct", ex);
_logger.LogError(ex, "Error getting image info from schedules direct");
return new List<ScheduleDirect.ShowImages>();
}
@ -557,35 +557,33 @@ namespace Emby.Server.Implementations.LiveTv.Listings
try
{
using (var httpResponse = await Get(options, false, info).ConfigureAwait(false))
using (Stream responce = httpResponse.Content)
{
using (Stream responce = httpResponse.Content)
{
var root = await _jsonSerializer.DeserializeFromStreamAsync<List<ScheduleDirect.Headends>>(responce).ConfigureAwait(false);
var root = await _jsonSerializer.DeserializeFromStreamAsync<List<ScheduleDirect.Headends>>(responce).ConfigureAwait(false);
if (root != null)
if (root != null)
{
foreach (ScheduleDirect.Headends headend in root)
{
foreach (ScheduleDirect.Headends headend in root)
foreach (ScheduleDirect.Lineup lineup in headend.lineups)
{
foreach (ScheduleDirect.Lineup lineup in headend.lineups)
lineups.Add(new NameIdPair
{
lineups.Add(new NameIdPair
{
Name = string.IsNullOrWhiteSpace(lineup.name) ? lineup.lineup : lineup.name,
Id = lineup.uri.Substring(18)
});
}
Name = string.IsNullOrWhiteSpace(lineup.name) ? lineup.lineup : lineup.name,
Id = lineup.uri.Substring(18)
});
}
}
else
{
_logger.LogInformation("No lineups available");
}
}
else
{
_logger.LogInformation("No lineups available");
}
}
}
catch (Exception ex)
{
_logger.LogError("Error getting headends", ex);
_logger.LogError(ex, "Error getting headends");
}
return lineups;

View File

@ -170,6 +170,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
_logger.LogError(ex, "Error");
}
}
image = librarySeries.GetImageInfo(ImageType.Backdrop, 0);
@ -185,6 +186,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
_logger.LogError(ex, "Error");
}
}
}
@ -212,6 +214,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
_logger.LogError(ex, "Error");
}
}
@ -230,6 +233,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
_logger.LogError(ex, "Error");
}
}
}
@ -260,6 +264,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
_logger.LogError(ex, "Error");
}
}
image = librarySeries.GetImageInfo(ImageType.Backdrop, 0);
@ -275,6 +280,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
_logger.LogError(ex, "Error");
}
}
}
@ -333,6 +339,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
_logger.LogError(ex, "Error");
}
}
}
@ -376,7 +383,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
_logger.LogError("Error getting image info for {0}", ex, info.Name);
_logger.LogError(ex, "Error getting image info for {name}", info.Name);
}
return null;

View File

@ -1089,7 +1089,7 @@ namespace Emby.Server.Implementations.LiveTv
{
cancellationToken.ThrowIfCancellationRequested();
_logger.LogDebug("Refreshing guide from {0}", service.Name);
_logger.LogDebug("Refreshing guide from {name}", service.Name);
try
{
@ -1108,7 +1108,7 @@ namespace Emby.Server.Implementations.LiveTv
catch (Exception ex)
{
cleanDatabase = false;
_logger.LogError("Error refreshing channels for service", ex);
_logger.LogError(ex, "Error refreshing channels for service");
}
numComplete++;
@ -1171,7 +1171,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
_logger.LogError("Error getting channel information for {0}", ex, channelInfo.Item2.Name);
_logger.LogError(ex, "Error getting channel information for {name}", channelInfo.Item2.Name);
}
numComplete++;
@ -1300,7 +1300,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
_logger.LogError("Error getting programs for channel {0}", ex, currentChannel.Name);
_logger.LogError(ex, "Error getting programs for channel {name}", currentChannel.Name);
}
numComplete++;
@ -1645,7 +1645,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
_logger.LogError("Error getting recordings", ex);
_logger.LogError(ex, "Error getting recordings");
return new List<Tuple<TimerInfo, ILiveTvService>>();
}
});
@ -1721,7 +1721,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
_logger.LogError("Error getting recordings", ex);
_logger.LogError(ex, "Error getting recordings");
return new List<Tuple<TimerInfo, ILiveTvService>>();
}
});
@ -1876,7 +1876,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
_logger.LogError("Error getting recordings", ex);
_logger.LogError(ex, "Error getting recordings");
return new List<Tuple<SeriesTimerInfo, ILiveTvService>>();
}
});
@ -1922,7 +1922,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
_logger.LogError("Error getting recordings", ex);
_logger.LogError(ex, "Error getting recordings");
return new List<Tuple<SeriesTimerInfo, ILiveTvService>>();
}
});

View File

@ -114,7 +114,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
catch (Exception ex)
{
Logger.LogError("Error getting channel list", ex);
Logger.LogError(ex, "Error getting channel list");
if (enableCache)
{
@ -161,7 +161,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
catch (Exception ex)
{
Logger.LogError("Error getting channels", ex);
Logger.LogError(ex, "Error getting channels");
}
}
}
@ -201,7 +201,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
catch (Exception ex)
{
Logger.LogError("Error getting channels", ex);
Logger.LogError(ex, "Error getting channels");
}
}
@ -221,7 +221,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
catch (Exception ex)
{
Logger.LogError("Error opening tuner", ex);
Logger.LogError(ex, "Error opening tuner");
}
}

View File

@ -303,7 +303,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
}
catch (Exception ex)
{
Logger.LogError("Error getting tuner info", ex);
Logger.LogError(ex, "Error getting tuner info");
}
}

View File

@ -56,7 +56,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(TempFilePath));
Logger.LogInformation("Opening HDHR UDP Live stream from {0}", uri.Host);
Logger.LogInformation("Opening HDHR UDP Live stream from {host}", uri.Host);
var remoteAddress = IPAddress.Parse(uri.Host);
var embyRemoteAddress = _networkManager.ParseIpAddress(uri.Host);
@ -69,9 +69,9 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
localAddress = ((IPEndPoint)tcpSocket.LocalEndPoint).Address;
tcpSocket.Close();
}
catch (Exception)
catch (Exception ex)
{
Logger.LogError("Unable to determine local ip address for Legacy HDHomerun stream.");
Logger.LogError(ex, "Unable to determine local ip address for Legacy HDHomerun stream.");
return;
}
}
@ -87,21 +87,19 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
catch (Exception ex)
{
using (udpClient)
using (hdHomerunManager)
{
using (hdHomerunManager)
if (!(ex is OperationCanceledException))
{
if (!(ex is OperationCanceledException))
{
Logger.LogError("Error opening live stream:", ex);
}
throw;
Logger.LogError(ex, "Error opening live stream:");
}
throw;
}
}
var taskCompletionSource = new TaskCompletionSource<bool>();
StartStreaming(udpClient, hdHomerunManager, remoteAddress, taskCompletionSource, LiveStreamCancellationTokenSource.Token);
await StartStreaming(udpClient, hdHomerunManager, remoteAddress, taskCompletionSource, LiveStreamCancellationTokenSource.Token);
//OpenedMediaSource.Protocol = MediaProtocol.File;
//OpenedMediaSource.Path = tempFile;
@ -122,26 +120,24 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
return Task.Run(async () =>
{
using (udpClient)
using (hdHomerunManager)
{
using (hdHomerunManager)
try
{
try
{
await CopyTo(udpClient, TempFilePath, openTaskCompletionSource, cancellationToken).ConfigureAwait(false);
}
catch (OperationCanceledException ex)
{
Logger.LogInformation("HDHR UDP stream cancelled or timed out from {0}", remoteAddress);
openTaskCompletionSource.TrySetException(ex);
}
catch (Exception ex)
{
Logger.LogError("Error opening live stream:", ex);
openTaskCompletionSource.TrySetException(ex);
}
EnableStreamSharing = false;
await CopyTo(udpClient, TempFilePath, openTaskCompletionSource, cancellationToken).ConfigureAwait(false);
}
catch (OperationCanceledException ex)
{
Logger.LogInformation("HDHR UDP stream cancelled or timed out from {0}", remoteAddress);
openTaskCompletionSource.TrySetException(ex);
}
catch (Exception ex)
{
Logger.LogError(ex, "Error opening live stream:");
openTaskCompletionSource.TrySetException(ex);
}
EnableStreamSharing = false;
}
await DeleteTempFiles(new List<string> { TempFilePath }).ConfigureAwait(false);
@ -166,30 +162,28 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
var resolved = false;
using (var source = _socketFactory.CreateNetworkStream(udpClient, false))
using (var fileStream = FileSystem.GetFileStream(file, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, FileOpenOptions.None))
{
using (var fileStream = FileSystem.GetFileStream(file, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, FileOpenOptions.None))
var currentCancellationToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, new CancellationTokenSource(TimeSpan.FromSeconds(30)).Token).Token;
while ((read = await source.ReadAsync(buffer, 0, buffer.Length, currentCancellationToken).ConfigureAwait(false)) != 0)
{
var currentCancellationToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, new CancellationTokenSource(TimeSpan.FromSeconds(30)).Token).Token;
cancellationToken.ThrowIfCancellationRequested();
while ((read = await source.ReadAsync(buffer, 0, buffer.Length, currentCancellationToken).ConfigureAwait(false)) != 0)
currentCancellationToken = cancellationToken;
read -= RtpHeaderBytes;
if (read > 0)
{
cancellationToken.ThrowIfCancellationRequested();
fileStream.Write(buffer, RtpHeaderBytes, read);
}
currentCancellationToken = cancellationToken;
read -= RtpHeaderBytes;
if (read > 0)
{
fileStream.Write(buffer, RtpHeaderBytes, read);
}
if (!resolved)
{
resolved = true;
DateOpened = DateTime.UtcNow;
Resolve(openTaskCompletionSource);
}
if (!resolved)
{
resolved = true;
DateOpened = DateTime.UtcNow;
Resolve(openTaskCompletionSource);
}
}
}

View File

@ -95,7 +95,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
catch (Exception ex)
{
Logger.LogError("Error closing live stream", ex);
Logger.LogError(ex, "Error closing live stream");
}
}
@ -139,7 +139,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
catch (Exception ex)
{
//Logger.LogError("Error deleting file {0}", ex, path);
Logger.LogError(ex, "Error deleting file {path}", path);
failedFiles.Add(path);
}
}
@ -242,7 +242,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
catch (Exception ex)
{
Logger.LogError("Error seeking stream", ex);
Logger.LogError(ex, "Error seeking stream");
}
}
}

View File

@ -138,7 +138,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
catch (Exception ex)
{
Logger.LogError("Error copying live stream.", ex);
Logger.LogError(ex, "Error copying live stream.");
}
EnableStreamSharing = false;
await DeleteTempFiles(new List<string> { TempFilePath }).ConfigureAwait(false);

View File

@ -166,7 +166,7 @@ namespace Emby.Server.Implementations.MediaEncoder
}
catch (Exception ex)
{
_logger.LogError("Error extracting chapter images for {0}", ex, string.Join(",", video.Path));
_logger.LogError(ex, "Error extracting chapter images for {0}", string.Join(",", video.Path));
success = false;
break;
}
@ -226,7 +226,7 @@ namespace Emby.Server.Implementations.MediaEncoder
foreach (var image in deadImages)
{
_logger.LogDebug("Deleting dead chapter image {0}", image);
_logger.LogDebug("Deleting dead chapter image {path}", image);
try
{
@ -234,7 +234,7 @@ namespace Emby.Server.Implementations.MediaEncoder
}
catch (IOException ex)
{
_logger.LogError("Error deleting {0}.", ex, image);
_logger.LogError(ex, "Error deleting {path}.", image);
}
}
}

View File

@ -36,7 +36,7 @@ namespace Emby.Server.Implementations.Networking
}
catch (Exception ex)
{
Logger.LogError("Error binding to NetworkAddressChanged event", ex);
Logger.LogError(ex, "Error binding to NetworkAddressChanged event");
}
try
@ -45,7 +45,7 @@ namespace Emby.Server.Implementations.Networking
}
catch (Exception ex)
{
Logger.LogError("Error binding to NetworkChange_NetworkAvailabilityChanged event", ex);
Logger.LogError(ex, "Error binding to NetworkChange_NetworkAvailabilityChanged event");
}
}
}
@ -372,7 +372,7 @@ namespace Emby.Server.Implementations.Networking
}
catch (Exception ex)
{
Logger.LogError("Error resovling hostname", ex);
Logger.LogError(ex, "Error resolving hostname");
}
}
}
@ -399,7 +399,7 @@ namespace Emby.Server.Implementations.Networking
}
catch (Exception ex)
{
Logger.LogError("Error in GetAllNetworkInterfaces", ex);
Logger.LogError(ex, "Error in GetAllNetworkInterfaces");
return new List<IPAddress>();
}
@ -428,7 +428,7 @@ namespace Emby.Server.Implementations.Networking
}
catch (Exception ex)
{
Logger.LogError("Error querying network interface", ex);
Logger.LogError(ex, "Error querying network interface");
return new List<IPAddress>();
}

View File

@ -67,7 +67,7 @@ namespace Emby.Server.Implementations.News
}
catch (Exception ex)
{
_logger.LogError("Error downloading news", ex);
_logger.LogError(ex, "Error downloading news");
}
}

View File

@ -59,7 +59,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
_logger.LogError("Error in Path.GetFullPath", ex);
_logger.LogError(ex, "Error in Path.GetFullPath");
}
// Don't allow file system access outside of the source folder

View File

@ -89,11 +89,11 @@ namespace Emby.Server.Implementations.ScheduledTasks
}
catch (HttpException ex)
{
_logger.LogError("Error downloading {0}", ex, package.name);
_logger.LogError(ex, "Error downloading {name}", package.name);
}
catch (IOException ex)
{
_logger.LogError("Error updating {0}", ex, package.name);
_logger.LogError(ex, "Error updating {name}", package.name);
}
// Update progress

View File

@ -146,7 +146,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
}
catch (Exception ex)
{
Logger.LogError("Error deserializing {0}", ex, path);
Logger.LogError(ex, "Error deserializing {path}", path);
}
_readFromFile = true;
}
@ -436,7 +436,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
}
catch (Exception ex)
{
Logger.LogError("Error", ex);
Logger.LogError(ex, "Error");
failureException = ex;
@ -669,7 +669,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
}
catch (Exception ex)
{
Logger.LogError("Error calling CancellationToken.Cancel();", ex);
Logger.LogError(ex, "Error calling CancellationToken.Cancel();");
}
}
var task = _currentTask;
@ -691,7 +691,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
}
catch (Exception ex)
{
Logger.LogError("Error calling Task.WaitAll();", ex);
Logger.LogError(ex, "Error calling Task.WaitAll();");
}
}
@ -704,7 +704,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
}
catch (Exception ex)
{
Logger.LogError("Error calling CancellationToken.Dispose();", ex);
Logger.LogError(ex, "Error calling CancellationToken.Dispose();");
}
}
if (wassRunning)

View File

@ -132,11 +132,11 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
}
catch (UnauthorizedAccessException ex)
{
_logger.LogError("Error deleting directory {0}", ex, directory);
_logger.LogError(ex, "Error deleting directory {path}", directory);
}
catch (IOException ex)
{
_logger.LogError("Error deleting directory {0}", ex, directory);
_logger.LogError(ex, "Error deleting directory {path}", directory);
}
}
}
@ -150,11 +150,11 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
}
catch (UnauthorizedAccessException ex)
{
_logger.LogError("Error deleting file {0}", ex, path);
_logger.LogError(ex, "Error deleting file {path}", path);
}
catch (IOException ex)
{
_logger.LogError("Error deleting file {0}", ex, path);
_logger.LogError(ex, "Error deleting file {path}", path);
}
}

View File

@ -83,7 +83,7 @@ namespace Emby.Server.Implementations.Security
}
catch (Exception ex)
{
Logger.LogError("Error migrating authentication database", ex);
Logger.LogError(ex, "Error migrating authentication database");
}
}

View File

@ -150,18 +150,15 @@ namespace Emby.Server.Implementations.Security
SaveAppStoreInfo(parameters);
throw;
}
catch (HttpException e)
catch (HttpException ex)
{
_logger.LogError("Error registering appstore purchase {0}", e, parameters ?? "NO PARMS SENT");
_logger.LogError(ex, "Error registering appstore purchase {parameters}", parameters ?? "NO PARMS SENT");
if (e.StatusCode.HasValue && e.StatusCode.Value == HttpStatusCode.PaymentRequired)
{
}
throw new Exception("Error registering store sale");
}
catch (Exception e)
catch (Exception ex)
{
_logger.LogError("Error registering appstore purchase {0}", e, parameters ?? "NO PARMS SENT");
_logger.LogError(ex, "Error registering appstore purchase {parameters}", parameters ?? "NO PARMS SENT");
SaveAppStoreInfo(parameters);
//TODO - could create a re-try routine on start-up if this file is there. For now we can handle manually.
throw new Exception("Error registering store sale");

View File

@ -79,7 +79,7 @@ namespace Emby.Server.Implementations.Udp
}
catch (Exception ex)
{
_logger.LogError("Error in OnMessageReceived", ex);
_logger.LogError(ex, "Error in OnMessageReceived");
}
}
}
@ -171,7 +171,7 @@ namespace Emby.Server.Implementations.Udp
}
catch (Exception ex)
{
_logger.LogError("Error receiving udp message", ex);
_logger.LogError(ex, "Error receiving udp message");
}
}
@ -193,7 +193,7 @@ namespace Emby.Server.Implementations.Udp
}
catch (Exception ex)
{
_logger.LogError("Error receiving udp message", ex);
_logger.LogError(ex, "Error receiving udp message");
}
BeginReceive();
@ -224,7 +224,7 @@ namespace Emby.Server.Implementations.Udp
}
catch (Exception ex)
{
_logger.LogError("Error handling UDP message", ex);
_logger.LogError(ex, "Error handling UDP message");
}
}
@ -274,7 +274,7 @@ namespace Emby.Server.Implementations.Udp
{
await _udpClient.SendToAsync(bytes, 0, bytes.Length, remoteEndPoint, cancellationToken).ConfigureAwait(false);
_logger.LogInformation("Udp message sent to {0}", remoteEndPoint);
_logger.LogInformation("Udp message sent to {remoteEndPoint}", remoteEndPoint);
}
catch (OperationCanceledException)
{
@ -282,7 +282,7 @@ namespace Emby.Server.Implementations.Udp
}
catch (Exception ex)
{
_logger.LogError("Error sending message to {0}", ex, remoteEndPoint);
_logger.LogError(ex, "Error sending message to {remoteEndPoint}", remoteEndPoint);
}
}
}

View File

@ -499,7 +499,7 @@ namespace Emby.Server.Implementations.Updates
}
catch (Exception ex)
{
_logger.LogError("Package installation failed", ex);
_logger.LogError(ex, "Package installation failed");
lock (CurrentInstallations)
{
@ -610,9 +610,9 @@ namespace Emby.Server.Implementations.Updates
_fileSystem.WriteAllText(target + ".ver", package.versionStr);
}
}
catch (IOException e)
catch (IOException ex)
{
_logger.LogError("Error attempting to move file from {0} to {1}", e, tempFile, target);
_logger.LogError(ex, "Error attempting to move file from {TempFile} to {TargetFile}", tempFile, target);
throw;
}
@ -620,10 +620,10 @@ namespace Emby.Server.Implementations.Updates
{
_fileSystem.DeleteFile(tempFile);
}
catch (IOException e)
catch (IOException ex)
{
// Don't fail because of this
_logger.LogError("Error deleting temp file {0]", e, tempFile);
_logger.LogError(ex, "Error deleting temp file {TempFile}", tempFile);
}
}

View File

@ -87,7 +87,7 @@ namespace Emby.XmlTv.Classes
if (string.IsNullOrEmpty(id))
{
//LLogError("No id found for channel row");
// LogError("No id found for channel row");
// Log.Error(" channel#{0} doesnt contain an id", iChannel);
return null;
}
@ -130,7 +130,7 @@ namespace Emby.XmlTv.Classes
if (string.IsNullOrEmpty(result.DisplayName))
{
//LLogError("No display-name found for channel {0}", id);
// LogError("No display-name found for channel {0}", id);
return null;
}

View File

@ -147,7 +147,7 @@ namespace MediaBrowser.Api
}
catch (Exception ex)
{
Logger.LogError("Error deleting encoded media cache", ex);
Logger.LogError(ex, "Error deleting encoded media cache");
}
}
@ -557,7 +557,7 @@ namespace MediaBrowser.Api
{
try
{
Logger.LogInformation("Stopping ffmpeg process with q command for {0}", job.Path);
Logger.LogInformation("Stopping ffmpeg process with q command for {path}", job.Path);
//process.Kill();
process.StandardInput.WriteLine("q");
@ -565,13 +565,13 @@ namespace MediaBrowser.Api
// Need to wait because killing is asynchronous
if (!process.WaitForExit(5000))
{
Logger.LogInformation("Killing ffmpeg process for {0}", job.Path);
Logger.LogInformation("Killing ffmpeg process for {path}", job.Path);
process.Kill();
}
}
catch (Exception ex)
{
Logger.LogError("Error killing transcoding job for {0}", ex, job.Path);
Logger.LogError(ex, "Error killing transcoding job for {path}", job.Path);
}
}
}
@ -589,7 +589,7 @@ namespace MediaBrowser.Api
}
catch (Exception ex)
{
Logger.LogError("Error closing live stream for {0}", ex, job.Path);
Logger.LogError(ex, "Error closing live stream for {path}", job.Path);
}
}
}
@ -620,15 +620,15 @@ namespace MediaBrowser.Api
{
}
catch (IOException)
catch (IOException ex)
{
//Logger.LogError("Error deleting partial stream file(s) {0}", ex, path);
Logger.LogError(ex, "Error deleting partial stream file(s) {path}", path);
DeletePartialStreamFiles(path, jobType, retryCount + 1, 500);
}
catch
catch (Exception ex)
{
//Logger.LogError("Error deleting partial stream file(s) {0}", ex, path);
Logger.LogError(ex, "Error deleting partial stream file(s) {path}", path);
}
}
@ -670,7 +670,7 @@ namespace MediaBrowser.Api
catch (IOException ex)
{
e = ex;
//Logger.LogError("Error deleting HLS file {0}", ex, file);
Logger.LogError(ex, "Error deleting HLS file {path}", file);
}
}

View File

@ -362,7 +362,7 @@ namespace MediaBrowser.Api.Images
}
catch (Exception ex)
{
Logger.LogError("Error getting image information for {0}", ex, info.Path);
Logger.LogError(ex, "Error getting image information for {path}", info.Path);
return null;
}

View File

@ -1001,7 +1001,7 @@ namespace MediaBrowser.Api.Library
}
catch (Exception ex)
{
Logger.LogError("Error refreshing library", ex);
Logger.LogError(ex, "Error refreshing library");
}
});
}

View File

@ -278,7 +278,7 @@ namespace MediaBrowser.Api.Playback
}
catch (Exception ex)
{
Logger.LogError("Error starting ffmpeg", ex);
Logger.LogError(ex, "Error starting ffmpeg");
ApiEntryPoint.Instance.OnTranscodeFailedToStart(outputPath, TranscodingJobType, state);
@ -372,7 +372,7 @@ namespace MediaBrowser.Api.Playback
//}
//catch (Exception ex)
//{
// Logger.LogError("Error disposing ffmpeg.", ex);
// Logger.LogError(ex, "Error disposing ffmpeg.");
//}
}

View File

@ -367,7 +367,7 @@ namespace MediaBrowser.Api.Playback.Hls
}
catch (IOException ex)
{
Logger.LogError("Error deleting partial stream file(s) {0}", ex, path);
Logger.LogError(ex, "Error deleting partial stream file(s) {path}", path);
var task = Task.Delay(100);
Task.WaitAll(task);
@ -375,7 +375,7 @@ namespace MediaBrowser.Api.Playback.Hls
}
catch (Exception ex)
{
Logger.LogError("Error deleting partial stream file(s) {0}", ex, path);
Logger.LogError(ex, "Error deleting partial stream file(s) {path}", path);
}
}

View File

@ -162,7 +162,7 @@ namespace MediaBrowser.Api.Playback
}
catch (Exception ex)
{
_logger.LogError("Error disposing log stream", ex);
_logger.LogError(ex, "Error disposing log stream");
}
LogFileStream = null;
@ -179,7 +179,7 @@ namespace MediaBrowser.Api.Playback
}
catch (Exception ex)
{
_logger.LogError("Error disposing TranscodingThrottler", ex);
_logger.LogError(ex, "Error disposing TranscodingThrottler");
}
TranscodingThrottler = null;
@ -196,7 +196,7 @@ namespace MediaBrowser.Api.Playback
}
catch (Exception ex)
{
_logger.LogError("Error closing media source", ex);
_logger.LogError(ex, "Error closing media source");
}
}
}

View File

@ -69,7 +69,7 @@ namespace MediaBrowser.Api.Playback
}
catch (Exception ex)
{
_logger.LogError("Error pausing transcoding", ex);
_logger.LogError(ex, "Error pausing transcoding");
}
}
}
@ -78,7 +78,7 @@ namespace MediaBrowser.Api.Playback
{
if (_isPaused)
{
_logger.LogDebug("Sending unpause command to ffmpeg");
_logger.LogDebug("Sending resume command to ffmpeg");
try
{
@ -87,7 +87,7 @@ namespace MediaBrowser.Api.Playback
}
catch (Exception ex)
{
_logger.LogError("Error unpausing transcoding", ex);
_logger.LogError(ex, "Error resuming transcoding");
}
}
}
@ -110,11 +110,11 @@ namespace MediaBrowser.Api.Playback
if (gap < targetGap)
{
//_logger.LogDebug("Not throttling transcoder gap {0} target gap {1}", gap, targetGap);
_logger.LogDebug("Not throttling transcoder gap {0} target gap {1}", gap, targetGap);
return false;
}
//_logger.LogDebug("Throttling transcoder gap {0} target gap {1}", gap, targetGap);
_logger.LogDebug("Throttling transcoder gap {0} target gap {1}", gap, targetGap);
return true;
}
@ -135,21 +135,21 @@ namespace MediaBrowser.Api.Playback
if (gap < targetGap)
{
//_logger.LogDebug("Not throttling transcoder gap {0} target gap {1} bytes downloaded {2}", gap, targetGap, bytesDownloaded);
_logger.LogDebug("Not throttling transcoder gap {0} target gap {1} bytes downloaded {2}", gap, targetGap, bytesDownloaded);
return false;
}
//_logger.LogDebug("Throttling transcoder gap {0} target gap {1} bytes downloaded {2}", gap, targetGap, bytesDownloaded);
_logger.LogDebug("Throttling transcoder gap {0} target gap {1} bytes downloaded {2}", gap, targetGap, bytesDownloaded);
return true;
}
catch
catch (Exception ex)
{
//_logger.LogError("Error getting output size");
_logger.LogError(ex, "Error getting output size");
return false;
}
}
//_logger.LogDebug("No throttle data for " + path);
_logger.LogDebug("No throttle data for " + path);
return false;
}

View File

@ -8,13 +8,13 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Plugins;
using MediaBrowser.Model.Serialization;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Services;
using MediaBrowser.Common.Plugins;
using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api
{
@ -230,9 +230,9 @@ namespace MediaBrowser.Api
.ToArray();
}
}
catch
catch (Exception ex)
{
//Logger.LogError("Error getting plugin list", ex);
Logger.LogError(ex, "Error getting plugin list");
// Play it safe here
if (requireAppStoreEnabled)
{

View File

@ -278,7 +278,7 @@ namespace MediaBrowser.Api.Subtitles
}
catch (Exception ex)
{
Logger.LogError("Error downloading subtitles", ex);
Logger.LogError(ex, "Error downloading subtitles");
}
});

View File

@ -28,7 +28,7 @@ namespace MediaBrowser.Common.Events
}
catch (Exception ex)
{
logger.LogError("Error in event handler", ex);
logger.LogError(ex, "Error in event handler");
}
});
}
@ -54,7 +54,7 @@ namespace MediaBrowser.Common.Events
}
catch (Exception ex)
{
logger.LogError("Error in event handler", ex);
logger.LogError(ex, "Error in event handler");
}
});
}
@ -77,7 +77,7 @@ namespace MediaBrowser.Common.Events
}
catch (Exception ex)
{
logger.LogError("Error in event handler", ex);
logger.LogError(ex, "Error in event handler");
}
}
}
@ -100,7 +100,7 @@ namespace MediaBrowser.Common.Events
}
catch (Exception ex)
{
logger.LogError("Error in event handler", ex);
logger.LogError(ex, "Error in event handler");
}
}
}

View File

@ -1414,7 +1414,7 @@ namespace MediaBrowser.Controller.Entities
}
catch (Exception ex)
{
Logger.LogError("Error refreshing owned items for {0}", ex, Path ?? Name);
Logger.LogError(ex, "Error refreshing owned items for {path}", Path ?? Name);
}
}

View File

@ -105,7 +105,7 @@ namespace MediaBrowser.Controller.Entities
}
catch (Exception ex)
{
Logger.LogError("Error loading library options", ex);
Logger.LogError(ex, "Error loading library options");
return new LibraryOptions();
}

View File

@ -303,7 +303,7 @@ namespace MediaBrowser.Controller.Entities
var id = child.Id;
if (dictionary.ContainsKey(id))
{
Logger.LogError("Found folder containing items with duplicate id. Path: {0}, Child Name: {1}",
Logger.LogError("Found folder containing items with duplicate id. Path: {path}, Child Name: {ChildName}",
Path ?? Name,
child.Path ?? child.Name);
}

View File

@ -259,10 +259,9 @@ namespace MediaBrowser.Controller.Entities
{
return _libraryManager.GetGenre(i);
}
catch
catch (Exception ex)
{
// Full exception logged at lower levels
_logger.LogError("Error getting genre");
_logger.LogError(ex, "Error getting genre");
return null;
}
@ -383,10 +382,9 @@ namespace MediaBrowser.Controller.Entities
{
return _libraryManager.GetGenre(i);
}
catch
catch (Exception ex)
{
// Full exception logged at lower levels
_logger.LogError("Error getting genre");
_logger.LogError(ex, "Error getting genre");
return null;
}

View File

@ -91,7 +91,7 @@ namespace MediaBrowser.Controller.IO
}
catch (Exception ex)
{
logger.LogError("Error resolving shortcut from {0}", ex, fullName);
logger.LogError(ex, "Error resolving shortcut from {path}", fullName);
}
}
else if (flattenFolderDepth > 0 && isDirectory)

View File

@ -727,7 +727,6 @@ namespace MediaBrowser.Controller.MediaEncoding
return count;
}
protected void DisposeIsoMount()
{
if (IsoMount != null)

View File

@ -232,7 +232,7 @@ namespace MediaBrowser.Controller.Net
}
catch (Exception ex)
{
Logger.LogError("Error sending web socket message {0}", ex, Name);
Logger.LogError(ex, "Error sending web socket message {Name}", Name);
DisposeConnection(tuple);
}
}

View File

@ -337,7 +337,7 @@ namespace MediaBrowser.Controller.Session
}
catch (Exception ex)
{
_logger.LogError("Error reporting playback progress", ex);
_logger.LogError(ex, "Error reporting playback progress");
}
}
@ -379,7 +379,7 @@ namespace MediaBrowser.Controller.Session
}
catch (Exception ex)
{
_logger.LogError("Error disposing session controller", ex);
_logger.LogError(ex, "Error disposing session controller");
}
}
}

View File

@ -135,7 +135,7 @@ namespace MediaBrowser.LocalMetadata.Savers
}
catch (Exception ex)
{
Logger.LogError("Error setting hidden attribute on {0} - {1}", path, ex.Message);
Logger.LogError(ex, "Error setting hidden attribute on {path}", path);
}
}

View File

@ -124,7 +124,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
}
catch (Exception ex)
{
Logger.LogError("Error starting ffmpeg", ex);
Logger.LogError(ex, "Error starting ffmpeg");
OnTranscodeFailedToStart(encodingJob.OutputFilePath, encodingJob);
@ -179,9 +179,9 @@ namespace MediaBrowser.MediaEncoding.Encoder
isSuccesful = exitCode == 0;
}
catch
catch (Exception ex)
{
Logger.LogError("FFMpeg exited with an error.");
Logger.LogError(ex, "FFMpeg exited with an error.");
}
if (isSuccesful && !job.IsCancelled)

View File

@ -41,7 +41,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
{
if (logOutput)
{
_logger.LogError("Error validating encoder", ex);
_logger.LogError(ex, "Error validating encoder");
}
}
@ -78,9 +78,9 @@ namespace MediaBrowser.MediaEncoding.Encoder
{
output = GetProcessOutput(encoderAppPath, "-decoders");
}
catch (Exception )
catch (Exception ex)
{
//_logger.LogError("Error detecting available decoders", ex);
_logger.LogError(ex, "Error detecting available decoders");
}
var found = new List<string>();
@ -187,7 +187,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
RedirectStandardOutput = true
});
_logger.LogInformation("Running {0} {1}", path, arguments);
_logger.LogInformation("Running {path} {arguments}", path, arguments);
using (process)
{
@ -199,16 +199,16 @@ namespace MediaBrowser.MediaEncoding.Encoder
}
catch
{
_logger.LogInformation("Killing process {0} {1}", path, arguments);
_logger.LogInformation("Killing process {path} {arguments}", path, arguments);
// Hate having to do this
try
{
process.Kill();
}
catch (Exception ex1)
catch (Exception ex)
{
_logger.LogError("Error killing process", ex1);
_logger.LogError(ex, "Error killing process");
}
throw;

View File

@ -81,7 +81,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
}
catch (Exception ex)
{
_logger.LogError("Error disposing log stream", ex);
_logger.LogError(ex, "Error disposing log stream");
}
LogFileStream = null;
@ -98,7 +98,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
}
catch (Exception ex)
{
_logger.LogError("Error closing media source", ex);
_logger.LogError(ex, "Error closing media source");
}
}
}

View File

@ -72,12 +72,12 @@ namespace MediaBrowser.MediaEncoding.Encoder
catch (HttpException ex)
{
// Don't let the server crash because of this
_logger.LogError("Error downloading ffmpeg font files", ex);
_logger.LogError(ex, "Error downloading ffmpeg font files");
}
catch (Exception ex)
{
// Don't let the server crash because of this
_logger.LogError("Error writing ffmpeg font files", ex);
_logger.LogError(ex, "Error writing ffmpeg font files");
}
}
@ -103,7 +103,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
catch (IOException ex)
{
// Log this, but don't let it fail the operation
_logger.LogError("Error copying file", ex);
_logger.LogError(ex, "Error copying file");
}
}
@ -127,7 +127,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
catch (Exception ex)
{
// The core can function without the font file, so handle this
_logger.LogError("Failed to download ffmpeg font file from {0}", ex, url);
_logger.LogError(ex, "Failed to download ffmpeg font file from {url}", url);
}
}
@ -145,12 +145,12 @@ namespace MediaBrowser.MediaEncoding.Encoder
catch (IOException ex)
{
// Log this, but don't let it fail the operation
_logger.LogError("Error deleting temp file {0}", ex, tempFile);
_logger.LogError(ex, "Error deleting temp file {path}", tempFile);
}
}
private void Extract7zArchive(string archivePath, string targetPath)
{
_logger.LogInformation("Extracting {0} to {1}", archivePath, targetPath);
_logger.LogInformation("Extracting {ArchivePath} to {TargetPath}", archivePath, targetPath);
_zipClient.ExtractAllFrom7z(archivePath, targetPath, true);
}

View File

@ -102,8 +102,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
_originalFFMpegPath = ffMpegPath;
_hasExternalEncoder = hasExternalEncoder;
SetEnvironmentVariable();
}
private readonly object _logLock = new object();
@ -117,7 +115,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
}
catch (Exception ex)
{
_logger.LogError("Error setting FFREPORT environment variable", ex);
_logger.LogError(ex, "Error setting FFREPORT environment variable");
}
}
}
@ -132,31 +130,11 @@ namespace MediaBrowser.MediaEncoding.Encoder
}
catch (Exception ex)
{
//_logger.LogError("Error setting FFREPORT environment variable", ex);
_logger.LogError(ex, "Error setting FFREPORT environment variable");
}
}
}
private void SetEnvironmentVariable()
{
try
{
//_environmentInfo.SetProcessEnvironmentVariable("FFREPORT", "file=program-YYYYMMDD-HHMMSS.txt:level=32");
}
catch (Exception ex)
{
_logger.LogError("Error setting FFREPORT environment variable", ex);
}
try
{
//_environmentInfo.SetUserEnvironmentVariable("FFREPORT", "file=program-YYYYMMDD-HHMMSS.txt:level=32");
}
catch (Exception ex)
{
_logger.LogError("Error setting FFREPORT environment variable", ex);
}
}
public string EncoderLocationType
{
get
@ -649,9 +627,9 @@ namespace MediaBrowser.MediaEncoding.Encoder
{
throw;
}
catch
catch (Exception ex)
{
_logger.LogError("I-frame image extraction failed, will attempt standard way. Input: {0}", inputArgument);
_logger.LogError(ex, "I-frame image extraction failed, will attempt standard way. Input: {arguments}", inputArgument);
}
}
@ -999,7 +977,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
}
catch (Exception ex)
{
_logger.LogError("Error in WaitForExit", ex);
_logger.LogError(ex, "Error in WaitForExit");
}
try
@ -1010,7 +988,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
}
catch (Exception ex)
{
_logger.LogError("Error killing process", ex);
_logger.LogError(ex, "Error killing process");
}
}

View File

@ -1351,11 +1351,11 @@ namespace MediaBrowser.MediaEncoding.Probing
{
video.Timestamp = GetMpegTimestamp(video.Path);
_logger.LogDebug("Video has {0} timestamp", video.Timestamp);
_logger.LogDebug("Video has {timestamp} timestamp", video.Timestamp);
}
catch (Exception ex)
{
_logger.LogError("Error extracting timestamp info from {0}", ex, video.Path);
_logger.LogError(ex, "Error extracting timestamp info from {path}", video.Path);
video.Timestamp = null;
}
}

View File

@ -431,7 +431,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
}
catch (Exception ex)
{
_logger.LogError("Error starting ffmpeg", ex);
_logger.LogError(ex, "Error starting ffmpeg");
throw;
}
@ -448,7 +448,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
}
catch (Exception ex)
{
_logger.LogError("Error killing subtitle conversion process", ex);
_logger.LogError(ex, "Error killing subtitle conversion process");
}
}
@ -471,7 +471,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
}
catch (IOException ex)
{
_logger.LogError("Error deleting converted subtitle {0}", ex, outputPath);
_logger.LogError(ex, "Error deleting converted subtitle {0}", outputPath);
}
}
}
@ -561,7 +561,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
}
catch (Exception ex)
{
_logger.LogError("Error starting ffmpeg", ex);
_logger.LogError(ex, "Error starting ffmpeg");
throw;
}
@ -578,7 +578,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
}
catch (Exception ex)
{
_logger.LogError("Error killing subtitle extraction process", ex);
_logger.LogError(ex, "Error killing subtitle extraction process");
}
}
@ -603,7 +603,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
}
catch (IOException ex)
{
_logger.LogError("Error deleting extracted subtitle {0}", ex, outputPath);
_logger.LogError(ex, "Error deleting extracted subtitle {0}", outputPath);
}
}
else if (!_fileSystem.FileExists(outputPath))

Some files were not shown because too many files have changed in this diff Show More