Я использую angular 7 с web api .netcore, для ведения журнала я использую JSNLOG, я могу в файле журнала то, что я написал в журнале, в то же время я нашел много информации в журнале, которая нам не нужна это в нашем файле
Log.Logger = new LoggerConfiguration()
.WriteTo.Console()
.ReadFrom.Configuration(Configuration)
.Destructure.JsonNetTypes()
.CreateLogger();
CreateWebHostBuilder(args).Build().Run();
var jsnlogConfiguration =
new JsnlogConfiguration
{
serverSideMessageFormat = "Sent: %date, %message",
enabled = false,
serverSideLogger = "Serilog",
loggers = new List<Logger> {
new Logger {
name = "Serilog",
disallow="^(App)"
}
}
};
this.logger.GetLogger(this.loggerName).info('Document component initialisé');
this.logger.GetLogger(this.loggerName).error('ERREUR TEST');
this.logger.GetLogger(this.loggerName).debug("debug client log message");
this.logger.GetLogger(this.loggerName).info("info client log message");
this.logger.GetLogger(this.loggerName).warn({ msg: 'warn client log message - logging object', x: 5, y: 88 });
this.logger.GetLogger(this.loggerName).error(function() { return "error client log message - returned by function"; });
this.logger.GetLogger(this.loggerName).fatal("fatal client log message");
this.logger.GetLogger(this.loggerName).fatalException("Something went wrong!", "test karim");
loggerSrvc.GetLogger("NG_App").trace('App: Test LogLevel 1000');
loggerSrvc.GetLogger("NG_App").debug('App: Test LogLevel 2000');
loggerSrvc.GetLogger("NG_App").info('App: Test LogLevel 3000');
loggerSrvc.GetLogger("NG_App").warn('App: Test LogLevel 4000');
loggerSrvc.GetLogger("NG_App").error('App: Test LogLevel 5000');
loggerSrvc.GetLogger("NG_App").fatal('App: Test LogLevel 6000');
часть результата:
нам не нужна эта часть
2019-04-09 10:49:37.399 -04:00 [DBG] The request has an origin header: 'http://localhost:5004'.
2019-04-09 10:49:37.400 -04:00 [INF] CORS policy execution failed.
2019-04-09 10:49:37.400 -04:00 [INF] Request origin http://localhost:5004 does not have permission to access the resource.
2019-04-09 10:49:37.400 -04:00 [DBG] POST requests are not supported
2019-04-09 10:49:37.400 -04:00 [DBG] Connection id "0HLLSVAAHMS5E", Request id "0HLLSVAAHMS5E:00000003": started reading request body.
2019-04-09 10:49:37.400 -04:00 [DBG] Connection id "0HLLSVAAHMS5E", Request id "0HLLSVAAHMS5E:00000003": done reading request body.
нам нужна эта часть
2019-04-09 10:49:37.400 -04:00 [DBG] App: Test LogLevel 2000
2019-04-09 10:49:37.401 -04:00 [INF] App: Test LogLevel 3000
2019-04-09 10:49:37.401 -04:00 [WRN] App: Test LogLevel 4000
2019-04-09 10:49:37.401 -04:00 [ERR] App: Test LogLevel 5000
2019-04-09 10:49:37.401 -04:00 [FTL] App: Test LogLevel 6000
2019-04-09 10:49:37.401 -04:00 [INF] Document component initialisé
2019-04-09 10:49:37.401 -04:00 [ERR] ERREUR TEST
2019-04-09 10:49:37.401 -04:00 [DBG] debug client log message
2019-04-09 10:49:37.401 -04:00 [INF] info client log message
нам эта часть не нужна
2019-04-09 10:49:37.403 -04:00 [INF] Executing endpoint
'Drc.Gcc.ServicesInternes.UI.Web.Controllers.DocumentController.AvoirAccesGcc (Drc.Gcc.ServicesInternes.UI.Web)'
2019-04-09 10:49:37.403 -04:00 [INF] Executing endpoint 'Drc.Gcc.ServicesInternes.UI.Web.Controllers.DocumentController.ObtenirListNomsDocument (Drc.Gcc.ServicesInternes.UI.Web)'
2019-04-09 10:49:37.429 -04:00 [WRN] [[[]],[[]],[[]]]
2019-04-09 10:49:37.430 -04:00 [ERR] error client log message - returned by function
2019-04-09 10:49:37.430 -04:00 [FTL] fatal client log message
2019-04-09 10:49:37.430 -04:00 [FTL] [[[]],[[]]]