# How to add data in alignment log

When more items need to be added into the default alignment log file (see more information in Logging Setup) , two ways of adding them are at your disposal.

## Add by script block in alignment task

This way applies when extra data is to be added to the right side of the last column in alignment log .

In alignment task, GenerateResultsPublisherAndLogger sub task has an open input pin named "UserLogData", this pin provides a window for user to add extra data to current station's alignment log file.

Suppose you want to log tact time of feature finder task, here are the steps:

1. Add a script block in alignment task, and configure its output pin as an OrderedDictionary object

2. Link the output pin to "UserLogData" input pin of GenerateResultsPublisherAndLogger

3. Within the script block, add "System.Collections.Specialized.dll" to its references.

4. Add the following code in the script block (The task name here should be the alignment task name in your own program).

5. Run program and run feature finding and alignment, then check the log file. There should be a extra column named "TactTime_Features0" at the end of the log file with tact time data.

## Add in log format callback function

If you want to insert columns in the default alignment log extra data, you achieve so in the log format call back function.

At the end of an alignment task, AlignPlus will call a script named as "<Alignment Name>_LogFormatCall" where alignment data is logged. The Alignment Name here is the name of the task. If a program has multiple alignment tasks, there would be multiple log format callbacks so that each task will have its own logging function.

The signature of log format call back is:

public void AlignmentTaskName_LogFormatCallback(CogDictionary resultsDict, List<string> orderedResultKeys, string errorMsg, List<string> csvHeader, List<string> csvData)

Here are its arguments.

Argument | Type | Description
--- | --- | ---
ResultsDict | CogDictionary | A dictionary of all saved alignment results
orderedResultKeys | List<string> | A list of key names whose data needs to be logged
errorMsg | string | Error message to log when alignment task fails
csvHeader | List<string> | The list of column names, by default it is the same with orderedResultKeys
csvData | List<string> | The list of data in string format extracted from ResutsDict using key names from orderedResultKeys

The following code shows an example to insert tact time after "ErrorCode" column.

Here is the alignment log result: