SharePoint: Programatically access audit report for sharepoint document library

Here is a Code Snippet for, if you want to know about the activities going on around your documents in a document library. For e.g. who downloaded the document or who did check in check out and at what time etc.

SPSite site = new SPSite("{YourSite}");

SPAudit _auditCol = site.Audit;

foreach (SPAuditEntry _audit in _auditCol)

{

string Loginfo = _audit.DocLocation + " – " + _audit.Event.ToString());

}