...
The value should be a string stating one of the two values:
- TRUE
The logger will cretae a log entry - FALSE
The logger will not cretae any logs at all
Code
The Logging functionality can be accessed from the static class simply called Log.cs.
...
| Code Block | ||||||
|---|---|---|---|---|---|---|
| ||||||
string invoker = "IntegrationApi"; /*The name of the application usin the log*/
string environmentVariableToggle = "INTEGRATIONAPI_LOGSTATE"; /*The environment variable name on the hosting of the invoking application*/
string appInsightsKey = "InstrumentationKey=xxxx"; /*The app insight key. This can be found in the appinsight application on the hosting environment*/
Log.Initialize(invoker, environmentVariableToggle, appInsightsKey); /*Initializing the logger, making it ready for use*/
Log.LogInfo("Integration api started.");
Log.LogInfo("Logger running"); |
When wanting to create a logentry do the following in the code:
| Code Block | ||||||
|---|---|---|---|---|---|---|
| ||||||
/*The logger have teh following options:*/
Log.LogInfo("This is an info message");
Log.LogDebug("This is a debug message");
Log.LogWarn("This is a warning message");
Log.LogException(new Exception("This is an exception message")); |