public ActionResult <SatisfactionInfoAddResModel> Manage_Satisfaction_Add(SatisfactionInfoAddViewModel satisfactionInfoAddViewModel)
        {
            int Node_Add_Count;

            Node_Add_Count = _ISatisfactionInfoService.SatisfactionInfo_Add(satisfactionInfoAddViewModel);
            SatisfactionInfoAddResModel satisfactionInfoAddResModel = new SatisfactionInfoAddResModel();

            if (Node_Add_Count > 0)
            {
                satisfactionInfoAddResModel.IsSuccess                  = true;
                satisfactionInfoAddResModel.AddCount                   = Node_Add_Count;
                satisfactionInfoAddResModel.baseViewModel.Message      = "添加成功";
                satisfactionInfoAddResModel.baseViewModel.ResponseCode = 200;
                _ILogger.Information("增加评论信息成功");
                return(Ok(satisfactionInfoAddResModel));
            }
            else
            {
                satisfactionInfoAddResModel.IsSuccess                  = false;
                satisfactionInfoAddResModel.AddCount                   = 0;
                satisfactionInfoAddResModel.baseViewModel.Message      = "添加失败";
                satisfactionInfoAddResModel.baseViewModel.ResponseCode = 400;
                _ILogger.Information("增加评论信息失败");
                return(Ok(satisfactionInfoAddResModel));
            }
        }
        private async Task ExecServiceAsync(IServiceVTEX _service, CancellationToken stoppingToken)
        {
            using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(5));
            using var cancellationTokenLinked = CancellationTokenSource.CreateLinkedTokenSource(stoppingToken, cancellationTokenSource.Token);
            bool hasMoreInThisMinute = true;

            while (hasMoreInThisMinute)
            {
                // waiting an opportunity to run an action
                await _semaphoreSlimAction.WaitAsync(stoppingToken);

                //_logger.Information($"Ejecutando servicio {_service}");

                hasMoreInThisMinute = await _service.DequeueProcessAndCheckIfContinueAsync(cancellationTokenLinked.Token);

                //_logger.Information($"Ejecutado y {(hasMoreInThisMinute ? "tiene" : "no tiene")} más items");

                if (!hasMoreInThisMinute)
                {
                    _logger.Information($"Release action sempahore after no more items, {_service.ToString()}");
                    _semaphoreSlimAction.Release(1);
                }
                else
                {
                    _ = Task.Delay(TimeSpan.FromSeconds(10)).ContinueWith(task =>
                    {
                        _logger.Debug("Release action sempahore to get more items");
                        _semaphoreSlimAction.Release(1);
                    });
                }
            }
        }
Пример #3
0
        protected async Task <ApplicationUser> CreateUserAsync(string userName, string password = null)
        {
            if (password == null)
            {
                password = StringUtils.GenerateSecureAlphanumericString(10);
            }

            var user = new ApplicationUser
            {
                UserName  = userName,
                FirstName = userName,
                LastName  = userName,
                Email     = $"{userName}@test.ru"
            };
            var result = await userManager.CreateAsync(user, password).ConfigureAwait(false);

            if (!result.Succeeded)
            {
                throw new InvalidOperationException($"Can't create user {userName} with password {password}:\n{string.Join("\n", result.Errors.Select(e => e.Description))}");
            }

            logger.Information($"User {userName} with password {password} successfully created");

            return(await userManager.FindByNameAsync(userName).ConfigureAwait(false));
        }
Пример #4
0
 public void Serilog_WithIf()
 {
     if (_sLogger.IsEnabled(Serilog.Events.LogEventLevel.Information))
     {
         _sLogger.Information(Message, 2022);
     }
 }
Пример #5
0
        public async Task Start()
        {
            _logger.Debug("Starting PizzaCore");
            await CreateConnection();

            _logger.Information("PizzaCore finished starting up.");
        }
Пример #6
0
        public void HandleRemovePlayer(int playerId, DisconnectReason reason)
        {
            if (_players.TryRemove(playerId, out var player))
            {
                player.Game = null;
            }

            Logger.Information("{0} - Player {1} ({2}) has left.", CodeStr, player?.Client.Name, playerId);

            // Game is empty, remove it.
            if (_players.Count == 0)
            {
                GameState = GameStates.Destroyed;

                // Remove instance reference.
                _gameManager.Remove(Code);
                return;
            }

            // Host migration.
            if (HostId == playerId)
            {
                var newHost = _players.First().Value;
                HostId = newHost.Client.Id;
                Logger.Information("{0} - Assigned {1} ({2}) as new host.", CodeStr, newHost.Client.Name, newHost.Client.Id);
            }

            using (var packet = MessageWriter.Get(SendOption.Reliable))
            {
                WriteRemovePlayerMessage(packet, false, playerId, reason);
                SendToAllExcept(packet, player);
            }
        }
Пример #7
0
        private void Start()
        {
            _infoButton.onClick.AddListener(() => _logger.Information("This is an info"));
            _warningButton.onClick.AddListener(() => _logger.Warning("This is a warning"));
            _errorButton.onClick.AddListener(() =>
            {
                try
                {
                    throw new InvalidOperationException("Invalid stuff");
                }
                catch (Exception e)
                {
                    _logger.Error(e, "This is an error");
                }
            });
            _threadButton.onClick.AddListener(() =>
            {
                var stopWatch = Stopwatch.StartNew();

                ThreadPool.QueueUserWorkItem(state =>
                {
                    stopWatch.Stop();
                    _logger.Information("Log from thread {Id}, Invoke took: {Elapsed}", Thread.CurrentThread.ManagedThreadId, stopWatch.Elapsed);
                });
            });
        }
Пример #8
0
        public void GetHash_Tests()
        {
            imgHashList = new List <ImgSimilarInfo>();
            foreach (var path in imageFilePaths)
            {
                var aa = new ImgSimilar(path.Path);
                aa.Width  = 16;
                aa.Height = 16;
                var hash = aa.GetHash();;
                imgHashList.Add(new ImgSimilarInfo()
                {
                    Name = path.Name,
                    Path = path.Path,
                    Hash = hash
                });
                //log.Information(path.Name + "----" + hash);
                foreach (var t in imgHashList)
                {
                    var count = ImgSimilar.CalcSimilarDegree(hash, t.Hash);
                    if (path.Name != t.Name)
                    {
                        log.Information($"{path.Name}:{t.Name}---{count}");
                    }
                }
                log.Information("----");
            }
            log.Information("----");


            Assert.IsNotEmpty(imgHashList);
        }
Пример #9
0
        public void Fact2()
        {
            LoggingLevelSwitch category1Switch = new LoggingLevelSwitch();

            bool CategoriesBelowCertainLevel(LogEvent e)
            {
                return(Matching.FromSource("Category1").Invoke(e) && e.Level < category1Switch.MinimumLevel);
            }

            Logger logger = new LoggerConfiguration()
                            .Enrich.FromLogContext()
                            .MinimumLevel.Verbose()
                            .Filter.ByExcluding(CategoriesBelowCertainLevel)
                            //.AuditTo.Sink()
                            .WriteTo.Logger(configuration => configuration
                                            .MinimumLevel.Warning()
                                            .MinimumLevel.Override("Category1", LogEventLevel.Information)
                                            .WriteTo.File("file1.log"))
                            .WriteTo.Console()
                            .CreateLogger();

            Serilog.ILogger category1Logger = logger.ForContext(Constants.SourceContextPropertyName, "Category1");
            Serilog.ILogger category2Logger = logger.ForContext(Constants.SourceContextPropertyName, "Category2");

            category1Logger.Information("visible");
            category2Logger.Information("invisible");

            category1Logger.Information("invisible");
            category2Logger.Information("visible");
        }
Пример #10
0
        public async Task Start()
        {
            var settings = new CatchUpSubscriptionSettings(
                2000
                , 500
                , _log.IsEnabled(LogEventLevel.Debug)
                , false);

            _log.Information("Starting the subscription manager...");

            var position = await _checkpointStore.GetCheckpoint();

            _log.Information("Retrieved the checkpoint: {checkpoint}", position);

            var _subscription = _connection.SubscribeToAllFrom(position
                                                               , settings
                                                               , EventAppeared
                                                               , LiveProcessingStarted
                                                               , SubscriptionDropped);

            // var _subscription = _connection.SubscribeToStreamFrom("$all"
            //                                                         ,position.Value.CommitPosition
            //                                                         , settings
            //                                                         , EventAppeared
            //                                                         , LiveProcessingStarted
            //                                                         , SubscriptionDropped);

            _log.Information("Subscribed to $all stream");
        }
        public async Task InitAsync()
        {
            _logger.Information("BotService Initializing");
            Register();
            _messageHandler.MessageReceived += async(s, e) => await ProcessMessageAsync(e).ConfigureAwait(false);

            await _messageHandler.InitAsync().ConfigureAwait(false);
        }
Пример #12
0
        /// <inheritdoc />
        public void Information <T1>(string template, T1 parameter1)
        {
            if (!IsEnabled(LogLevel.Information))
            {
                return;
            }

            _target.Information(template, parameter1);
        }
Пример #13
0
        public async Task <IActionResult> Subscribe(
            [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "subscribe")] HttpRequest req,
            [Table("subscriptions", Connection = "AzureWebJobsStorage")] CloudTable subTable)
        {
            try
            {
                await subTable.CreateIfNotExistsAsync();

                var graphClient = GetGraphClient(configuration.GraphV1);

                var requestBody = await new StreamReader(req.Body).ReadToEndAsync();
                var createSub   = JsonConvert.DeserializeObject <CreateSubscription>(requestBody);

                var subscription = new Subscription
                {
                    ChangeType         = createSub.ChangeType,
                    ClientState        = createSub.ClientState,
                    ExpirationDateTime = createSub.ExpirationDateTime,
                    NotificationUrl    = createSub.NotificationUrl.IsNullOrWhiteSpace() ?
                                         $"{configuration.MeetingRoomsApi}/notification" :
                                         createSub.NotificationUrl,
                    Resource = createSub.Resource
                };

                var existingSubs = (await graphClient.Subscriptions.Request()
                                    //.Filter($"resource eq '{subscription.Resource}'")
                                    .GetAsync()).ToList();
                var existingSub = existingSubs.SingleOrDefault(s => s.Resource.Equals(subscription.Resource, StringComparison.InvariantCultureIgnoreCase));
                if (existingSub != null)
                {
                    await graphClient.Subscriptions[existingSub.Id].Request().DeleteAsync();

                    var retrieve = TableOperation.Retrieve <SubscriptionEntity>("SUBSCRIPTION", existingSub.Id);
                    var sub      = (await subTable.ExecuteAsync(retrieve)).Result;
                    if (sub != null)
                    {
                        var deleteOperation = TableOperation.Delete((SubscriptionEntity)sub);
                        await subTable.ExecuteAsync(deleteOperation);
                    }
                }

                var createdSub = await graphClient.Subscriptions.Request().AddAsync(subscription);

                var insertOperation = TableOperation.Insert(createdSub.ToSubscriptionEntity());
                await subTable.ExecuteAsync(insertOperation);

                log.Information($"Created new subscription with id:{createdSub.Id}");

                return(new OkObjectResult(Result.Ok()));
            }
            catch (Exception e)
            {
                var error = $"{e.Message}\n\r{e.StackTrace}";
                log.Error(error);
                return(new OkObjectResult(Result.Fail(error)));
            }
        }
Пример #14
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, Microsoft.AspNetCore.Hosting.IHostingEnvironment env, ILoggerFactory loggerFactory, ILogger <Startup> _log)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseCors(builder =>
            {
                builder.AllowAnyMethod()
                .AllowAnyHeader()
                .AllowAnyOrigin();
            });

            app.UseHttpsRedirection();
            app.UseSession();
            app.UseMvcWithDefaultRoute();

            loggerFactory.AddSerilog();

            Serilog.ILogger log = Log.Logger.ForContext <Startup>().Here();
            try
            {
                KGDataAccessor.initInstance(Configuration);
                log.Information("MongoDB is initialized.");
            }
            catch (Exception e)
            {
                log.Error("Exception in MongoDB initializing.\n" + e.Message);
            }

            try
            {
                KGDataAccessor            accessor = KGDataAccessor.GetInstance();
                List <Vertex>             vList    = accessor.GetVertexCollection();
                List <Edge>               eList    = accessor.GetEdgeCollection();
                List <VisulizationConfig> vcList   = accessor.GetVisulizationConfigs();

                DataPersistanceKGParser kgParser = new DataPersistanceKGParser(vList, eList, vcList);
                kgParser.ParseKG();

                log.Information("Knowledge Graph is parsed.");
                Console.WriteLine("Knowledge Graph is parsed.");
            }
            catch (Exception e)
            {
                log.Error("Exception in KnowledgeGraph parsing.\n" + e.Message);
                Console.WriteLine("[Error]" + e.Message);
            }
        }
Пример #15
0
        // database
        private static async Task <(string StreamName, long Version)[]> InitializeStremVersions(string[] knownStreams)
        {
            _log.Information("Initializing known streams versions in database");

            await StreamVersionsManager.InitializeStreamVersions(knownStreams);

            var streamVersions = await StreamVersionsManager.GetStreamVersions();

            return(streamVersions);
        }
Пример #16
0
        //Inicializo el cliente cuando arranca el servicio
        public override Task StartAsync(CancellationToken cancellationToken)
        {
            client     = new CoapClient();
            client.Uri = uri;

            _logger.Information("COAP uri: " + uri.ToString());

            servicioSeguridad = FactoriaServicios.GetServicioSeguridad();

            return(base.StartAsync(cancellationToken));
        }
Пример #17
0
 /// <summary>
 /// Start the given host and log failing exceptions.
 /// </summary>
 /// <param name="host">The host to start.</param>
 /// <param name="cancellationToken">A token to allow one to stop the host.</param>
 private async Task _StartWithHost(IHost host, CancellationToken cancellationToken)
 {
     try
     {
         _logger.Information("Running as {Name}", Environment.UserName);
         _logger.Information("Version: {Version}", Assembly.GetExecutingAssembly().GetName().Version.ToString(3));
         _logger.Information("Data directory: {DataDirectory}", GetDataDirectory());
         await host.RunAsync(cancellationToken);
     }
     catch (Exception ex)
     {
         _logger.Fatal(ex, "Unhandled exception");
     }
 }
Пример #18
0
        public async Task <TResponse> Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate <TResponse> next)
        {
            string requestName = typeof(TRequest).Name;
            string unqiueId    = Guid.NewGuid().ToString();

            _logger.Information($"Begin Request Id:{unqiueId}, request name:{requestName}");
            var timer = new Stopwatch();

            timer.Start();
            var response = await next();

            timer.Stop();
            _logger.Information($"Begin Request Id:{unqiueId}, request name:{requestName}, total request time:{timer.ElapsedMilliseconds}");
            return(response);
        }
Пример #19
0
        private static InvocationInfo GetStartupInvocation()
        {
            var startupFile = BuildScriptDll + ".startup";
            var begin       = startupFile.IsFile()
                ? startupFile.LastWriteTimeUtc()
                : Process.GetCurrentProcess().StartTime.ToUniversalTime();

            var end             = DateTime.UtcNow;
            var startupDuration = end - begin;

            Logger.Information("Startup duration: {startupDuration}", startupDuration);
            var startupInvocation = new InvocationInfo("startup", begin, end);

            return(startupInvocation);
        }
Пример #20
0
 private void ShowMessage(string text, NotificationSetting notificationSetting)
 {
     if (notificationSetting.Text)
     {
         logger.Information(text);
     }
     if (notificationSetting.Speech)
     {
         Speak(text);
     }
     if (Settings.ConnectToPipeServer)
     {
         pipeMessages.Enqueue(text);
     }
 }
Пример #21
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            Log.Information("Configuring services.");

            // Add framework services.
            services.AddMvc();
            services.AddMvcCore()
            .AddJsonFormatters(options =>
                               options.ContractResolver = new CamelCasePropertyNamesContractResolver());

            services.AddSwaggerGen(SetupSwagger);

            // Add SimpleInjector Controller Activator
            services.AddSingleton <IControllerActivator>(new SimpleInjectorControllerActivator(container));
            services.UseSimpleInjectorAspNetRequestScoping(container);
        }
        /// <summary>
        /// The UseExceptionHandler middleware is a built-in middleware
        /// </summary>
        /// <param name="app"></param>
        public static void ConfigureExceptionHandler(this IApplicationBuilder app, ILogger seriLogger) //, ILoggerManager logger)
        {
            // built-in middleware
            app.UseExceptionHandler(appError =>
            {
                appError.Run(async context =>
                {
                    context.Response.StatusCode  = (int)HttpStatusCode.InternalServerError;
                    context.Response.ContentType = "application/json";

                    var contextFeature = context.Features.Get <IExceptionHandlerFeature>();
                    if (contextFeature != null)
                    {
                        //LogError($"Something went wrong: {contextFeature.Error}");
                        seriLogger.Information($"Something went wrong: {contextFeature.Error}");

                        await context.Response.WriteAsync(new ErrorDetailModel()
                        {
                            StatusCode = context.Response.StatusCode,
                            Message    = "Middleware says: Internal Server Error. "
                        }.ToString());
                    }
                });
            });
        }
Пример #23
0
    private static Serilog.ILogger CreateLogger()
    {
        if (!Directory.Exists(logFileFolder))
        {
            Directory.CreateDirectory(logFileFolder);
        }
        int fileSizeLimitBytes = 250 * 1000 * 1000; // 250 MB
        LoggerConfiguration loggerConfiguration = new LoggerConfiguration()
                                                  .MinimumLevel.Information()
                                                  .Enrich.FromLogContext()
                                                  .Enrich.With <UnityStackTraceEnricher>()
                                                  .WriteTo.Sink(new UnityLogEventSink())
                                                  .WriteTo.File(
            logFilePath,                                                                          // path
            LogEventLevel.Verbose,                                                                // restrictedToMinimumLevel
            "{Timestamp:yyyy-MM-dd HH:mm:ss.fff} [{Level:u3}] {Message:lj}{NewLine}{StackTrace}", // outputTemplate
            null,                                                                                 // formatProvider
            fileSizeLimitBytes,                                                                   // fileSizeLimitBytes
            null,                                                                                 // levelSwitch
            false,                                                                                // buffered
            false,                                                                                // shared
            null,                                                                                 // flushToDiskInterval
            RollingInterval.Day,                                                                  // rollingInterval
            false,                                                                                // rollOnFileSizeLimit
            5,                                                                                    // retainedFileCountLimit
            System.Text.Encoding.UTF8,                                                            // Encoding
            null);                                                                                // FileLifecycleHooks

        Serilog.ILogger logger = loggerConfiguration.CreateLogger();
        logger.Information("===== Initialized Serilog Logger =====");
        return(logger);
    }
Пример #24
0
        public async Task Invoke(HttpContext context)
        {
            _logger.Information(await FormatRequest(context.Request));

            var originalBodyStream = context.Response.Body;

            using (var responseBody = new MemoryStream())
            {
                context.Response.Body = responseBody;

                await _next(context);

                _logger.Information(await FormatResponse(context.Response));
                await responseBody.CopyToAsync(originalBodyStream);
            }
        }
Пример #25
0
    public static void HandleUnityLog(string logString, string stackTrace, LogType type)
    {
        if (logString.EndsWith(UnityLogEventSink.unityLogEventSinkMarker))
        {
            // Has already been logged to the Unity Console.
            return;
        }

        Serilog.ILogger loggerWithContext = Logger.ForContext(UnityLogEventSink.skipUnityLogEventSinkPropertyName, true);

        switch (type)
        {
        case LogType.Warning:
            loggerWithContext.Warning(logString);
            break;

        case LogType.Assert:
        case LogType.Error:
        case LogType.Exception:
            loggerWithContext.Error(logString + "\n" + stackTrace);
            break;

        default:
            loggerWithContext.Information(logString);
            break;
        }
    }
Пример #26
0
        public static void ConfigureExceptionHandler(this IApplicationBuilder app, Serilog.ILogger logger)
        {
            app.UseExceptionHandler(appError =>
            {
                appError.Run(async context =>
                {
                    context.Response.StatusCode  = (int)HttpStatusCode.InternalServerError;
                    context.Response.ContentType = "application/json";

                    var contextFeature = context.Features.Get <IExceptionHandlerFeature>();
                    if (contextFeature != null)
                    {
                        logger.Information($"Something went wrong: {contextFeature.Error}");



                        if (contextFeature.Error.GetType() == typeof(ProcessException))
                        {
                            await context.Response.WriteAsync(JsonConvert.SerializeObject(new ResponseModel <object>(null, false, contextFeature.Error.Message)));
                        }
                        else
                        {
                            await context.Response.WriteAsync(JsonConvert.SerializeObject(new ResponseModel <object>(null, false, "Server Error")));
                        }
                    }
                });
            });
        }
            public override async Task InvokeAsync(IPipeContext context, CancellationToken ct)
            {
                var msgType = context.GetMessageType();

                _logger.Information("Message of type {messageType} just published", msgType.Name);
                await Next.InvokeAsync(context, ct);
            }
Пример #28
0
 public void Info(string template, params object[] values)
 {
     if (_inner.IsEnabled(LogEventLevel.Information))
     {
         _inner.Information(template, values);
     }
 }
Пример #29
0
        // TODO Flush / close when exiting
        static GlobalLogging()
        {
            DiagnosticStopWatch = new Stopwatch();

            var userProfile   = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
            var ownVersion    = typeof(GlobalLogging).Assembly.GetName().Version;
            var dynamoVersion = typeof(IsVisibleInDynamoLibraryAttribute).Assembly.GetName().Version;

            log = new LoggerConfiguration()
                  .MinimumLevel.ControlledBy(new LoggingLevelSwitch(Serilog.Events.LogEventLevel.Debug))

                  /*.WriteTo.Async(a => a.File(
                   *  $"{userProfile}\\TRexIfc-{ownVersion.Major}.{ownVersion.Minor}_Dynamo-{dynamoVersion.Major}.{dynamoVersion.Minor}_.log",
                   *  rollingInterval: RollingInterval.Day,
                   *  rollOnFileSizeLimit: true,
                   *  outputTemplate: messageTemplate), bufferSize: 500)*/
                  .WriteTo.File(
                $"{userProfile}\\TRexIfc-{ownVersion.Major}.{ownVersion.Minor}_Dynamo-{dynamoVersion.Major}.{dynamoVersion.Minor}_.log",
                buffered: false,
                rollingInterval: RollingInterval.Day,
                rollOnFileSizeLimit: true,
                outputTemplate: messageTemplate)
                  .Enrich.WithThreadId()
                  .Enrich.WithThreadName()
                  .Enrich.FromLogContext()
                  .CreateLogger();

            loggingFactory     = new LoggerFactory().AddSerilog(log, true);
            Serilog.Log.Logger = log;

            log.Information($"Started TRexIfc-{ownVersion} on Dynamo-{dynamoVersion} host at {DateTime.Now}.");
        }
        /// <summary>
        /// Initializes a new instance of Advanced logger
        /// </summary>
        /// <param name="enableSerilogRequestResponseLoggingForDebug"></param>
        /// <param name="enableSerilogRequestResponseLoggingForTrace"></param>
        /// <param name="enableSerilogRequestResponseLoggingForConsole"></param>
        /// <param name="enableSerilogRequestResponseLoggingForFile"></param>
        /// <param name="serviceRequestLoggingLocationForFile"></param>
        public OAuthAdvancedLogging(bool enableSerilogRequestResponseLoggingForDebug, bool enableSerilogRequestResponseLoggingForTrace, bool enableSerilogRequestResponseLoggingForConsole, bool enableSerilogRequestResponseLoggingForFile, string serviceRequestLoggingLocationForFile)
        {
            this.EnableSerilogRequestResponseLoggingForDebug   = enableSerilogRequestResponseLoggingForDebug;
            this.EnableSerilogRequestResponseLoggingForTrace   = enableSerilogRequestResponseLoggingForTrace;
            this.EnableSerilogRequestResponseLoggingForConsole = enableSerilogRequestResponseLoggingForConsole;
            this.EnableSerilogRequestResponseLoggingForFile    = enableSerilogRequestResponseLoggingForFile;
            this.ServiceRequestLoggingLocationForFile          = serviceRequestLoggingLocationForFile;



            string filePath = string.Empty;

            if (this.EnableSerilogRequestResponseLoggingForFile)
            {
                //Assign tempath if no location found
                if (string.IsNullOrWhiteSpace(this.ServiceRequestLoggingLocationForFile))
                {
                    this.ServiceRequestLoggingLocationForFile = Path.GetTempPath();
                }


                //Log file path for widows n ios
                filePath = Path.Combine(this.ServiceRequestLoggingLocationForFile, "QBOApiLogs-" + DateTime.Now.Ticks.ToString(CultureInfo.InvariantCulture) + ".txt");
            }

            //Setting logger config for Serilog
            var loggerConfig = new LoggerConfiguration()
                               .MinimumLevel.Verbose();


            //Enabling console log
            if (this.EnableSerilogRequestResponseLoggingForConsole == true)
            {
                loggerConfig = loggerConfig.WriteTo.Console();
            }

            //Enabling Trace log
            if (this.EnableSerilogRequestResponseLoggingForTrace == true)
            {
                loggerConfig = loggerConfig.WriteTo.Trace();
            }

            //Enabling Debug log
            if (this.EnableSerilogRequestResponseLoggingForDebug == true)
            {
                loggerConfig = loggerConfig.WriteTo.Debug();
            }

            //Enabling file log
            if (!string.IsNullOrEmpty(this.ServiceRequestLoggingLocationForFile) && this.EnableSerilogRequestResponseLoggingForFile == true)
            {
                loggerConfig = loggerConfig.WriteTo.File(filePath);
            }

            //Creating the Logger for Serilog
            logger = loggerConfig.CreateLogger();

            //Logging first info
            logger.Information("Logger is initialized");
        }