//very expensive performance wise so call it only for errors public static void LogAsError(this object error) { var method = new StackFrame(1).GetMethod(); string caller = method.DeclaringType.ToString() + "." + method.Name; PluginLogger.Error(caller + "|" + error ?? "<null>"); }