I have to read text file that has millions of records. while reading file I have to implement something like "Tracker" which will write last read LineNumber to log file. I don't want this log file open and write operation affect my application performance. can anyone suggest me how to implement it?
P.S. I am using yield to read this big file, and I have multiple files like that. I want to stop reading operation if file has some invalid record...While this read operation is going on I want to somehow want to let end users know that so far it has read so and so number of line - file read is in progress. 

```
    using (StreamReader reader = new StreamReader(_fileNameAndPath))
                {
                    while (reader.EndOfStream == false)
                    {
                        string data = reader.ReadLine();

                        _fileLineNumber = _fileLineNumber + 1;
  //this line number should go to tracker file Logger.Trace(_fileLineNumber )

                       //............
                     }
                }

```

Logger class :

```
public static class Logger 
{     
      .....
      public static void Trace(string message)
      {
          FileStream fileStream = new FileStream(logFilePath, FileMode.Append);
          StreamWriter streamWriter = new StreamWriter(fileStream);
          streamWriter.WriteLine(message); 
      }

}

```