Logging Library // Algo Trading Platform (Trading Engine) Series
Coding Jesus Coding Jesus
96.6K subscribers
9,246 views
206

 Published On Aug 7, 2021

This is episode two of the trading series. Here I write a logging library with an accompanying text logger implementation. Note, there are dozens of ways to incorporate logging. Some people use third party libraries, others build entire tools outside their main application to handle logging. can use a third party logger If you’d like, or build a conpletelt seperate tool outside the Trading Engine application for logging. I decided to write my own library for several reasons: a) we want it to be dependency injection friendly b) other text-based logger libraries are rigid and one cannot customize the format we'd like to emit the log in, and c) the whole point of this series is to learn how to write code in the context of building a trading application. Prop firms don't often rely on other people's code for something as critical as text logging. Some exceptions may be trace logging which are non-ascii based logs (binary logs). Some useful public libraries for tracing exist, for example in C++: https://github.com/morganstanley/binlog. Given that this is a series where we're meant to learn, instead of copying other people's code, we'll probably write our own tracing library as well when we need it.

www.codingjesus.com

Source code: https://github.com/Tzadiko/Trading-En...

Logging MR: https://github.com/Tzadiko/Trading-En...

IDisposable Pattern: https://docs.microsoft.com/en-us/dotn...
Finalizers: https://docs.microsoft.com/en-us/dotn...
Record Type: https://docs.microsoft.com/en-us/dotn...

Join this channel to get access to perks:
   / @codingjesus  

Would you like to join the Patron-only Discord by tithing to The Church of Coding Jesus 💸? https://www.patreon.com/codingjesus?f...

1-on-1 private resume reviews and career consulting/mentoring 🗓️: calendly.com/coding-jesus

Instagram: @thecodingjesus

Email: [email protected]

87wZCoEfvb6AXfJtwwv2EGVc3f6UafSZM39CZ2xRLU1dKvLYK3x6JGbP4bj8iatHdwU3BnSvPfyKPVjwDKBepufSRDT1Kub

00:00 Introduction
00:40 Why not use ILogger?
02:20 Creating LoggerCS
03:20 Adjust csproj file
04:00 The goal of this video
04:20 Logging priority levels
05:05 ILogger interface
09:22 Abstract logger
13:20 Various logger types
14:20 Visualizing the end result/goal
16:24 ITextLogger interface
17:30 TextLogger concrete class implementation
18:50 TextLogger configuration values
26:08 Add TextLogger to dependency injection container
27:00 Overriding the Log method
29:10 Storing log information in an immutable fashion
31:05 Threadsafe queue for passing information to our logging task
33:10 LogAsync long running task
37:50 Formatting our log
40:00 Kicking off our logging task in TextLogger constructor
41:20 Creating the log file path
44:20 Cancelling the long running logging task
48:50 Replacing ILogger with TextLogger
50:20 Generating unique log files to prevent log files being overridden
52:30 Logger configuration dependency injection
53:10 Debugging exception in TextLogger configuration
54:20 Debugging Filestream exception
56:40 TextLogger persisting data to file successfully

part 2 of trading engine series, learning to build a trading engine in csharp from scratch. Quant dev work and internal systems to simulate trades, trading etc. algo trading platform algorithm trading platform series trading series

show more

Share/Embed