logging abstraction

This commit is contained in:
Shaun Walker
2019-10-26 11:00:45 -04:00
parent f59ec7bdac
commit e25bbe2e24
23 changed files with 79 additions and 72 deletions

View File

@ -76,7 +76,7 @@ namespace Oqtane.Controllers
if (ModelState.IsValid)
{
Module = Modules.AddModule(Module);
logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Create, "Module Added {Module}", Module);
logger.Log(LogLevel.Information, this, LogFunction.Create, "Module Added {Module}", Module);
}
return Module;
}
@ -89,7 +89,7 @@ namespace Oqtane.Controllers
if (ModelState.IsValid)
{
Module = Modules.UpdateModule(Module);
logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Update, "Module Updated {Module}", Module);
logger.Log(LogLevel.Information, this, LogFunction.Update, "Module Updated {Module}", Module);
}
return Module;
}
@ -100,7 +100,7 @@ namespace Oqtane.Controllers
public void Delete(int id)
{
Modules.DeleteModule(id);
logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Delete, "Module Deleted {ModuleId}", id);
logger.Log(LogLevel.Information, this, LogFunction.Delete, "Module Deleted {ModuleId}", id);
}
// GET api/<controller>/export?moduleid=x
@ -141,7 +141,7 @@ namespace Oqtane.Controllers
}
}
content = JsonSerializer.Serialize(modulecontent);
logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Read, "Module Content Exported {ModuleId}", moduleid);
logger.Log(LogLevel.Information, this, LogFunction.Read, "Module Content Exported {ModuleId}", moduleid);
}
}
}
@ -187,7 +187,7 @@ namespace Oqtane.Controllers
var moduleobject = ActivatorUtilities.CreateInstance(ServiceProvider, moduletype);
((IPortable)moduleobject).ImportModule(module, modulecontent.Content, modulecontent.Version);
success = true;
logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Update, "Module Content Imported {ModuleId}", moduleid);
logger.Log(LogLevel.Information, this, LogFunction.Update, "Module Content Imported {ModuleId}", moduleid);
}
}
}