https://github.com/nethereum/nethereumnlogsample
Logging trace requests example using nlog
https://github.com/nethereum/nethereumnlogsample
Last synced: about 1 year ago
JSON representation
Logging trace requests example using nlog
- Host: GitHub
- URL: https://github.com/nethereum/nethereumnlogsample
- Owner: Nethereum
- Created: 2022-10-05T11:39:52.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-10-05T11:49:25.000Z (over 3 years ago)
- Last Synced: 2025-01-11T21:24:40.809Z (about 1 year ago)
- Language: C#
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Nethereum Nlog Sample
Logging trace requests example using nlog

Nethereum uses **"Trace"** to log requests and responses, so the configuration needs to be configured as such.
More info on setup Nlog can be found here: https://github.com/NLog/NLog/wiki/Getting-started-with-.NET-Core-2---Console-application#a-minimal-example
**Example configuration file:**
```xml
```
**Simple program**
```csharp
var logger = LoggerFactory.Create(builder => builder.AddNLog()).CreateLogger();
logger.LogInformation("hello info!");
logger.LogTrace("hello trace!");
var web3 = new Web3("http://localhost:8545", logger);
var blocknumber = await web3.Eth.Blocks.GetBlockNumber.SendRequestAsync();
Console.ReadLine();
```