MagFlux: - modbus_master_csharp re-import

This commit is contained in:
Thomas Wiedebusch
2023-11-02 14:27:33 +01:00
parent 5393db957b
commit fb420da05d
10 changed files with 775 additions and 284 deletions
@@ -77,6 +77,26 @@ namespace XYLEM.Base.Files
return nameTxt;
}
/// <summary>
/// Automated get function name for the function calling this
/// Used for automating getting a function name to write in a log
/// </summary>
/// <param name="inclMsg">Add extra message to log with function name </param>
/// <returns>"[CALLING_FUNCTION_NAME]() -> [inclMsg]"</returns>
[MethodImpl(MethodImplOptions.NoInlining)]
public static string GetCurrentStaticMethod(string inclMsg = null)
{
var st = new StackTrace();
var sf = st.GetFrame(1);
var nameTxt = $"{sf.GetMethod().Name}()";
if (!String.IsNullOrEmpty(inclMsg))
{
nameTxt += " -> " + inclMsg;
}
return nameTxt;
}
internal void AddToLogFile(bool isError, string nameSingleLine, string infoMultibleLines)
{
AddToLogFile(isError, StdLogFilePath, nameSingleLine, infoMultibleLines);