user
user
CC#
Created by user on 5/10/2024 in #help
func wont print the logging level before the exception
private static IPAddress GetIpAddressFromDomain(string domain)
{
IPAddress[] addresses = Dns.GetHostAddresses(domain);
foreach (IPAddress address in addresses)
{
if (address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
{
return address;
}
}
Console.ForegroundColor = ConsoleColor.Red;
Console.Write("[" + currentTimeforlogs.ToString("HH:mm:ss") + " ERROR]");
Console.ResetColor();
throw new Exception($"Failed to resolve IP address for domain: {domain}");
}
}
private static IPAddress GetIpAddressFromDomain(string domain)
{
IPAddress[] addresses = Dns.GetHostAddresses(domain);
foreach (IPAddress address in addresses)
{
if (address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
{
return address;
}
}
Console.ForegroundColor = ConsoleColor.Red;
Console.Write("[" + currentTimeforlogs.ToString("HH:mm:ss") + " ERROR]");
Console.ResetColor();
throw new Exception($"Failed to resolve IP address for domain: {domain}");
}
}
it just wont print the [{time} ERROR] then the exception, it just prints the exception, also i need help with getting IPs from domain names, ill send the src if i have to.
6 replies