mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-20 09:04:42 +01:00
Use Microsoft.Extensions.Logging abstraction
This commit is contained in:
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SQLitePCL.pretty;
|
||||
using System.Linq;
|
||||
using SQLitePCL;
|
||||
@@ -75,22 +75,22 @@ namespace Emby.Server.Implementations.Data
|
||||
if (!_versionLogged)
|
||||
{
|
||||
_versionLogged = true;
|
||||
Logger.Info("Sqlite version: " + SQLite3.Version);
|
||||
Logger.Info("Sqlite compiler options: " + string.Join(",", SQLite3.CompilerOptions.ToArray()));
|
||||
Logger.LogInformation("Sqlite version: " + SQLite3.Version);
|
||||
Logger.LogInformation("Sqlite compiler options: " + string.Join(",", SQLite3.CompilerOptions.ToArray()));
|
||||
}
|
||||
|
||||
ConnectionFlags connectionFlags;
|
||||
|
||||
if (isReadOnly)
|
||||
{
|
||||
//Logger.Info("Opening read connection");
|
||||
//Logger.LogInformation("Opening read connection");
|
||||
//connectionFlags = ConnectionFlags.ReadOnly;
|
||||
connectionFlags = ConnectionFlags.Create;
|
||||
connectionFlags |= ConnectionFlags.ReadWrite;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Logger.Info("Opening write connection");
|
||||
//Logger.LogInformation("Opening write connection");
|
||||
connectionFlags = ConnectionFlags.Create;
|
||||
connectionFlags |= ConnectionFlags.ReadWrite;
|
||||
}
|
||||
@@ -114,7 +114,7 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
_defaultWal = db.Query("PRAGMA journal_mode").SelectScalarString().First();
|
||||
|
||||
Logger.Info("Default journal_mode for {0} is {1}", DbFilePath, _defaultWal);
|
||||
Logger.LogInformation("Default journal_mode for {0} is {1}", DbFilePath, _defaultWal);
|
||||
}
|
||||
|
||||
var queries = new List<string>
|
||||
@@ -235,7 +235,7 @@ namespace Emby.Server.Implementations.Data
|
||||
}
|
||||
|
||||
db.ExecuteAll(string.Join(";", queries.ToArray()));
|
||||
Logger.Info("PRAGMA synchronous=" + db.Query("PRAGMA synchronous").SelectScalarString().First());
|
||||
Logger.LogInformation("PRAGMA synchronous=" + db.Query("PRAGMA synchronous").SelectScalarString().First());
|
||||
}
|
||||
|
||||
protected virtual bool EnableTempStoreMemory
|
||||
@@ -323,7 +323,7 @@ namespace Emby.Server.Implementations.Data
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.ErrorException("Error disposing database", ex);
|
||||
Logger.LogError("Error disposing database", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -47,7 +47,7 @@ namespace Emby.Server.Implementations.Data
|
||||
var numComplete = 0;
|
||||
var numItems = itemIds.Count;
|
||||
|
||||
_logger.Debug("Cleaning {0} items with dead parent links", numItems);
|
||||
_logger.LogDebug("Cleaning {0} items with dead parent links", numItems);
|
||||
|
||||
foreach (var itemId in itemIds)
|
||||
{
|
||||
@@ -57,7 +57,7 @@ namespace Emby.Server.Implementations.Data
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
_logger.Info("Cleaning item {0} type: {1} path: {2}", item.Name, item.GetType().Name, item.Path ?? string.Empty);
|
||||
_logger.LogInformation("Cleaning item {0} type: {1} path: {2}", item.Name, item.GetType().Name, item.Path ?? string.Empty);
|
||||
|
||||
_libraryManager.DeleteItem(item, new DeleteOptions
|
||||
{
|
||||
@@ -75,4 +75,4 @@ namespace Emby.Server.Implementations.Data
|
||||
progress.Report(100);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using SQLitePCL.pretty;
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Emby.Server.Implementations.Data
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.ErrorException("Error loading database file. Will reset and retry.", ex);
|
||||
Logger.LogError("Error loading database file. Will reset and retry.", ex);
|
||||
|
||||
FileSystem.DeleteFile(DbFilePath);
|
||||
|
||||
@@ -251,4 +251,4 @@ namespace Emby.Server.Implementations.Data
|
||||
return GetDisplayPreferences(displayPreferencesId, new Guid(userId), client);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.LiveTv;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Model.Reflection;
|
||||
@@ -667,7 +667,7 @@ namespace Emby.Server.Implementations.Data
|
||||
var userDataKey = tuple.Item4;
|
||||
|
||||
SaveItem(item, topParent, userDataKey, saveItemStatement);
|
||||
//Logger.Debug(_saveItemCommand.CommandText);
|
||||
//logger.LogDebug(_saveItemCommand.CommandText);
|
||||
|
||||
var inheritedTags = tuple.Item5;
|
||||
|
||||
@@ -886,12 +886,12 @@ namespace Emby.Server.Implementations.Data
|
||||
|
||||
if (topParent != null)
|
||||
{
|
||||
//Logger.Debug("Item {0} has top parent {1}", item.Id, topParent.Id);
|
||||
//logger.LogDebug("Item {0} has top parent {1}", item.Id, topParent.Id);
|
||||
saveItemStatement.TryBind("@TopParentId", topParent.Id.ToString("N"));
|
||||
}
|
||||
else
|
||||
{
|
||||
//Logger.Debug("Item {0} has null top parent", item.Id);
|
||||
//logger.LogDebug("Item {0} has null top parent", item.Id);
|
||||
saveItemStatement.TryBindNull("@TopParentId");
|
||||
}
|
||||
|
||||
@@ -1230,7 +1230,7 @@ namespace Emby.Server.Implementations.Data
|
||||
}
|
||||
|
||||
CheckDisposed();
|
||||
//Logger.Info("Retrieving item {0}", id.ToString("N"));
|
||||
//logger.LogInformation("Retrieving item {0}", id.ToString("N"));
|
||||
using (WriteLock.Read())
|
||||
{
|
||||
using (var connection = CreateConnection(true))
|
||||
@@ -1345,7 +1345,7 @@ namespace Emby.Server.Implementations.Data
|
||||
|
||||
if (type == null)
|
||||
{
|
||||
//Logger.Debug("Unknown type {0}", typeString);
|
||||
//logger.LogDebug("Unknown type {0}", typeString);
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -1364,7 +1364,7 @@ namespace Emby.Server.Implementations.Data
|
||||
}
|
||||
catch (SerializationException ex)
|
||||
{
|
||||
Logger.ErrorException("Error deserializing item", ex);
|
||||
Logger.LogError("Error deserializing item", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2686,7 +2686,7 @@ namespace Emby.Server.Implementations.Data
|
||||
|
||||
CheckDisposed();
|
||||
|
||||
//Logger.Info("GetItemList: " + _environmentInfo.StackTrace);
|
||||
//logger.LogInformation("GetItemList: " + _environmentInfo.StackTrace);
|
||||
|
||||
var now = DateTime.UtcNow;
|
||||
|
||||
@@ -2744,7 +2744,7 @@ namespace Emby.Server.Implementations.Data
|
||||
|
||||
CheckDisposed();
|
||||
|
||||
//Logger.Info("GetItemList: " + _environmentInfo.StackTrace);
|
||||
//logger.LogInformation("GetItemList: " + _environmentInfo.StackTrace);
|
||||
|
||||
var now = DateTime.UtcNow;
|
||||
|
||||
@@ -2910,14 +2910,14 @@ namespace Emby.Server.Implementations.Data
|
||||
|
||||
if (elapsed >= slowThreshold)
|
||||
{
|
||||
Logger.Debug("{2} query time (slow): {0}ms. Query: {1}",
|
||||
Logger.LogDebug("{2} query time (slow): {0}ms. Query: {1}",
|
||||
Convert.ToInt32(elapsed),
|
||||
commandText,
|
||||
methodName);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Logger.Debug("{2} query time: {0}ms. Query: {1}",
|
||||
//logger.LogDebug("{2} query time: {0}ms. Query: {1}",
|
||||
// Convert.ToInt32(elapsed),
|
||||
// commandText,
|
||||
// methodName);
|
||||
@@ -2942,7 +2942,7 @@ namespace Emby.Server.Implementations.Data
|
||||
TotalRecordCount = returnList.Count
|
||||
};
|
||||
}
|
||||
//Logger.Info("GetItems: " + _environmentInfo.StackTrace);
|
||||
//logger.LogInformation("GetItems: " + _environmentInfo.StackTrace);
|
||||
|
||||
var now = DateTime.UtcNow;
|
||||
|
||||
@@ -3216,7 +3216,7 @@ namespace Emby.Server.Implementations.Data
|
||||
}
|
||||
|
||||
CheckDisposed();
|
||||
//Logger.Info("GetItemIdsList: " + _environmentInfo.StackTrace);
|
||||
//logger.LogInformation("GetItemIdsList: " + _environmentInfo.StackTrace);
|
||||
|
||||
var now = DateTime.UtcNow;
|
||||
|
||||
@@ -3376,7 +3376,7 @@ namespace Emby.Server.Implementations.Data
|
||||
TotalRecordCount = returnList.Count
|
||||
};
|
||||
}
|
||||
//Logger.Info("GetItemIds: " + _environmentInfo.StackTrace);
|
||||
//logger.LogInformation("GetItemIds: " + _environmentInfo.StackTrace);
|
||||
|
||||
var now = DateTime.UtcNow;
|
||||
|
||||
@@ -5565,7 +5565,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||
}
|
||||
|
||||
CheckDisposed();
|
||||
//Logger.Info("GetItemValues: " + _environmentInfo.StackTrace);
|
||||
//logger.LogInformation("GetItemValues: " + _environmentInfo.StackTrace);
|
||||
|
||||
var now = DateTime.UtcNow;
|
||||
|
||||
@@ -5734,7 +5734,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||
var list = new List<Tuple<BaseItem, ItemCounts>>();
|
||||
var result = new QueryResult<Tuple<BaseItem, ItemCounts>>();
|
||||
|
||||
//Logger.Info("GetItemValues {0}", string.Join(";", statementTexts.ToArray()));
|
||||
//logger.LogInformation("GetItemValues {0}", string.Join(";", statementTexts.ToArray()));
|
||||
var statements = PrepareAllSafe(db, statementTexts);
|
||||
|
||||
if (!isReturningZeroItems)
|
||||
|
||||
@@ -7,7 +7,7 @@ using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SQLitePCL.pretty;
|
||||
using MediaBrowser.Controller.Library;
|
||||
|
||||
@@ -416,4 +416,4 @@ namespace Emby.Server.Implementations.Data
|
||||
// handled by library database
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using SQLitePCL.pretty;
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Emby.Server.Implementations.Data
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.ErrorException("Error migrating users database", ex);
|
||||
Logger.LogError("Error migrating users database", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,4 +233,4 @@ namespace Emby.Server.Implementations.Data
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user