logging abstraction
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
{
|
||||
public interface IInstallationManager
|
||||
{
|
||||
void InstallPackages(string Folders);
|
||||
void InstallPackages(string Folders, bool Restart);
|
||||
void RestartApplication();
|
||||
}
|
||||
}
|
||||
|
@ -6,8 +6,8 @@ namespace Oqtane.Infrastructure
|
||||
{
|
||||
public interface ILogManager
|
||||
{
|
||||
void Log(LogLevel Level, string Category, LogFunction Function, string Message, params object[] Args);
|
||||
void Log(LogLevel Level, string Category, LogFunction Function, Exception Exception, string Message, params object[] Args);
|
||||
void Log(LogLevel Level, object Class, LogFunction Function, string Message, params object[] Args);
|
||||
void Log(LogLevel Level, object Class, LogFunction Function, Exception Exception, string Message, params object[] Args);
|
||||
void Log(Log Log);
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ namespace Oqtane.Infrastructure
|
||||
this.environment = environment;
|
||||
}
|
||||
|
||||
public void InstallPackages(string Folders)
|
||||
public void InstallPackages(string Folders, bool Restart)
|
||||
{
|
||||
bool install = false;
|
||||
string binfolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
||||
@ -73,7 +73,7 @@ namespace Oqtane.Infrastructure
|
||||
}
|
||||
}
|
||||
|
||||
if (install)
|
||||
if (install && Restart)
|
||||
{
|
||||
// restart application
|
||||
RestartApplication();
|
||||
|
@ -25,12 +25,12 @@ namespace Oqtane.Infrastructure
|
||||
this.Accessor = Accessor;
|
||||
}
|
||||
|
||||
public void Log(LogLevel Level, string Category, LogFunction Function, string Message, params object[] Args)
|
||||
public void Log(LogLevel Level, object Class, LogFunction Function, string Message, params object[] Args)
|
||||
{
|
||||
Log(Level, Category, Function, null, Message, Args);
|
||||
Log(Level, Class.GetType().AssemblyQualifiedName, Function, null, Message, Args);
|
||||
}
|
||||
|
||||
public void Log(LogLevel Level, string Category, LogFunction Function, Exception Exception, string Message, params object[] Args)
|
||||
public void Log(LogLevel Level, object Class, LogFunction Function, Exception Exception, string Message, params object[] Args)
|
||||
{
|
||||
Alias alias = TenantResolver.GetAlias();
|
||||
Log log = new Log();
|
||||
@ -47,8 +47,15 @@ namespace Oqtane.Infrastructure
|
||||
log.Url = request.Scheme.ToString() + "://" + request.Host.ToString() + request.Path.ToString() + request.QueryString.ToString();
|
||||
}
|
||||
|
||||
log.Category = Category;
|
||||
log.Feature = Utilities.GetTypeNameLastSegment(Category, 0);
|
||||
if (Class.GetType() != null)
|
||||
{
|
||||
log.Category = Class.GetType().AssemblyQualifiedName;
|
||||
}
|
||||
else
|
||||
{
|
||||
log.Category = Class.ToString();
|
||||
}
|
||||
log.Feature = Utilities.GetTypeNameLastSegment(log.Category, 0);
|
||||
log.Function = Enum.GetName(typeof(LogFunction), Function);
|
||||
log.Level = Enum.GetName(typeof(LogLevel), Level);
|
||||
if (Exception != null)
|
||||
|
Reference in New Issue
Block a user