/// <summary> /// Logs the entry if allowed by the associated policy. /// </summary> /// <returns> /// true - if the entry was logged successfully. /// false - if the entry was not logged because of an error or policy did not allow it. /// </returns> public bool Log(ILogEntry logEntry) { // // Check with policy first. // if (logFilter.CanLog(logEntry)) { // // Policy is okay with it, write it if allowed by file size limits. // if (!startWritten) { logFile.Write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Log>\r\n"); startWritten = true; } if (logFile.BaseStream.Position < maxLogSize) { logEntry.WriteRaw(logFile); return(true); } else { RaiseLogFileFullEvent(); return(false); } } else { return(false); } }