// Do not add a format string overload. In general, execution context messages are user facing and // therefore should be localized. Use the Loc methods from the StringUtil class. The exception to // the rule is command messages - which should be crafted using strongly typed wrapper methods. public long Write(string tag, string message) { string msg = HostContext.SecretMasker.MaskSecrets($"{tag}{message}"); long totalLines; lock (_loggerLock) { totalLines = _logger.TotalLines + 1; _logger.Write(msg); } // write to job level execution context's log file. var parentContext = _parentExecutionContext as ExecutionContext; if (parentContext != null) { lock (parentContext._loggerLock) { parentContext._logger.Write(msg); } } _jobServerQueue.QueueWebConsoleLine(_record.Id, msg); return(totalLines); }
// Do not add a format string overload. In general, execution context messages are user facing and // therefore should be localized. Use the Loc methods from the StringUtil class. The exception to // the rule is command messages - which should be crafted using strongly typed wrapper methods. public long Write(string tag, string message) { string msg = HostContext.SecretMasker.MaskSecrets($"{tag}{message}"); long totalLines; lock (_loggerLock) { totalLines = _logger.TotalLines + 1; if (_disableLogUploads) { _buildLogsWriter.WriteLine(msg); } else { _logger.Write(msg); } } if (!_disableLogUploads) { // write to job level execution context's log file. var parentContext = _parentExecutionContext as ExecutionContext; if (parentContext != null) { lock (parentContext._loggerLock) { parentContext._logger.Write(msg); } } _jobServerQueue.QueueWebConsoleLine(_record.Id, msg, totalLines); } // write to plugin daemon, if (_outputForward) { if (_logPlugin == null) { _logPlugin = HostContext.GetService <IAgentLogPlugin>(); } _logPlugin.Write(_record.Id, msg); } return(totalLines); }
// Do not add a format string overload. In general, execution context messages are user facing and // therefore should be localized. Use the Loc methods from the StringUtil class. The exception to // the rule is command messages - which should be crafted using strongly typed wrapper methods. public void Write(string tag, string message) { string msg = _secretMasker.MaskSecrets($"{tag}{message}"); lock (_loggerLock) { _logger.Write(msg); } // write to job level execution context's log file. var parentContext = _parentExecutionContext as ExecutionContext; if (parentContext != null) { lock (parentContext._loggerLock) { parentContext._logger.Write(msg); } } _jobServerQueue.QueueWebConsoleLine(msg); }