SharePoint 2010: Using Event Receivers, Example 5: Logging Events
Event receivers in SharePoint Foundation 2010 enable your custom code to respond when specific actions occur on a SharePoint object. This sample captures every event that occurs on a site collection and records each event as a list item.