there is a logging class that logs user activities into a database .
as I didn’t wanted to write logging codes in all methods ( violating SRP principle if I’m not wrong ) , I decided to define events and raise them in methods .
then add a class that contains event handling methods to subscribe to events and use logging class to log necessary data into database.
another point is that during a request several events may raise and I want to catch them all and add logs to the database in one transaction .
now I wonder where and how should I instantiate this handling class to achieve this goal ?
I’m using Asp.net WebForms .
SRP would not be violated by adding logging statements into your methods.
You shouldn’t re-invent the wheel unless you have a very specific need. Use Log4Net or some other logging framework.