You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

About

In this page, it is described how to add teh project to your sollution and how to use the functionality in it.

Adding the project to your sollution

To use the project functionality, you need to first add the library to your sollution. 
It is done in Visual Studio by following those steps:

  1. Right click the sollution explorer on the top level sollution
  2. Choose Add→Existing project
  3. Navigate to EGU.PartnerPortal.Shared project
  4. Double click the csproj file
  5. Now add teh project reference inside your project
  6. Right click the sollution explorer in Dependencies→Projects→Add Project Reference
  7. Add a tag in teh shared project:

The project is now ready for use.

Using the Logging

Hosting environment

The way the logging work is, that it checks an environment setting on the application level in the hosting weather or not to log.

Therefore, it is important that you setup a variable for this. 

The variable should follow the following format: 

<MainApplicationname>_LOGSTATE 

For instance: 

INTEGRATIONAPI_LOGSTATE

The value should be a string stating one of the two values:

  • TRUE
  • FALSE

Code

The Logging functionality can be accessed from the static class simply called Log.cs. 

Before being able to log through the project you need to initialize the logger. 

Initializing is done in this way: 

Logger initialization
string invoker = "IntegrationApi";
string environmentVariableToggle = "INTEGRATIONAPI_LOGSTATE";
string appInsightsKey = "InstrumentationKey=xxxx";

Log.Initialize(invoker, environmentVariableToggle, appInsightsKey);
Log.LogInfo("Integration api started.");
Log.LogInfo("Logger running");




Other functionality

  • No labels