For TFS 2010 we used:
context.TrackBuildMessage(message, BuildMessageImportance.High);
context.TrackBuildWarning(message);
context.TrackBuildError(message);
context.TrackBuildWarning(message);
For TFS 2012 there appears to only be a Track method on context. However my attempts at testing and tracking an error do not work and show me nothing in the build log.
context.Track(new CustomTrackingRecord(message, System.Diagnostics.TraceLevel.Error));
In TFS 2012 you need to use the TrackingExtensions
class.
Just add a using to this namespace to get access to the methods.
using Microsoft.TeamFoundation.Build.Workflow.Activities;