Move to .net 10 and improve default behavour of logging
This commit is contained in:
parent
8e41d15e4e
commit
21662a367e
@ -11,14 +11,14 @@ namespace BlubbFish.Utils.IoT.Bots {
|
||||
|
||||
public Boolean DebugLogging {
|
||||
get;
|
||||
}
|
||||
} = false;
|
||||
|
||||
public ABot(String[] _, Boolean fileLogging, String configSearchPath) {
|
||||
InIReader.SetSearchPath(new List<String>() { "/etc/"+ configSearchPath, Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\"+ configSearchPath });
|
||||
if(fileLogging) {
|
||||
if(fileLogging && InIReader.ConfigExist("settings") && Boolean.TryParse(InIReader.GetInstance("settings").GetValue("logging", "enabled", "false"), out Boolean _)) {
|
||||
this.logger = new ProgramLogger(InIReader.GetInstance("settings").GetValue("logging", "path", Assembly.GetEntryAssembly().GetName().Name + ".log"));
|
||||
}
|
||||
if(Boolean.TryParse(InIReader.GetInstance("settings").GetValue("logging", "debug", "true"), out Boolean debuglog)) {
|
||||
if(InIReader.ConfigExist("settings") && Boolean.TryParse(InIReader.GetInstance("settings").GetValue("logging", "debug", "true"), out Boolean debuglog)) {
|
||||
this.DebugLogging = debuglog;
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,8 @@ namespace BlubbFish.Utils.IoT.Bots {
|
||||
|
||||
protected HttpListener httplistener;
|
||||
|
||||
public AWebserver(String[] args, Boolean fileLogging, String configSearchPath, Dictionary<String, String> settings) : base(args, fileLogging, configSearchPath) => this.config = settings;
|
||||
public AWebserver(String[] args, Boolean fileLogging, String configSearchPath, Dictionary<String, String> settings) : base(args, fileLogging, configSearchPath) =>
|
||||
this.config = this.config is null ? InIReader.GetInstance("settings").GetSection("webserver") : settings;
|
||||
|
||||
protected void StartListen() {
|
||||
this.httplistener = new HttpListener();
|
||||
|
||||
@ -7,7 +7,8 @@ using BlubbFish.Utils.IoT.Events;
|
||||
namespace BlubbFish.Utils.IoT.Bots {
|
||||
public abstract class AWebserverDataBackend : AWebserver {
|
||||
protected ABackend databackend;
|
||||
protected AWebserverDataBackend(String[] args, Boolean fileLogging, String configSearchPath, ABackend backend, Dictionary<String, String> settings) : base(args, fileLogging, configSearchPath, settings) => this.databackend = backend;
|
||||
protected AWebserverDataBackend(String[] args, Boolean fileLogging, String configSearchPath, ABackend backend, Dictionary<String, String> settings) : base(args, fileLogging, configSearchPath, settings) =>
|
||||
this.databackend = backend is null ? ABackend.GetInstance(InIReader.GetInstance("settings").GetSection("backend")) : backend;
|
||||
|
||||
protected void StartDataBackend() => this.databackend.MessageIncomming += this.Backend_MessageIncomming;
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<RootNamespace>BlubbFish.Utils.IoT.Bots</RootNamespace>
|
||||
<AssemblyName>Bot-Utils</AssemblyName>
|
||||
<PackageId>Bots.IoT.Utils.BlubbFish</PackageId>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user