I saw the answers to the chain of constructors, but they do not apply to my problem.
I have the following constructor that requires a couple of parameters:
public SerilogHelper(string conString, int minLevel) { var levelSwitch = new LoggingLevelSwitch(); levelSwitch.MinimumLevel = (Serilog.Events.LogEventLevel)(Convert.ToInt32(minLevel)); _logger = new LoggerConfiguration() .MinimumLevel.ControlledBy(levelSwitch) .WriteTo.MSSqlServer(connectionString: conString, tableName: "Logs", autoCreateSqlTable: true) .CreateLogger(); }
One particular client of this constructor will not have the values โโneeded for the parameters, so I would like to be able to call this simple constructor, which will get the required values, and then call the 1st constructor:
public SerilogHelper() { string minLevel = SSOSettingsFileManager.SSOSettingsFileReader.ReadString( "LCC.Common", "serilog.level"); string conString = SSOSettingsFileManager.SSOSettingsFileReader.ReadString( "LCC.Common", "serilog.connectionstring"); SerilogHelper(conString, minLevel); }
The problem is that I get red squiggly when called to the second constructor with the message SerilogHelper is a "type" but is used as a "variable"
source share