You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
845 B
31 lines
845 B
using Microsoft.Extensions.Hosting;
|
|
using System;
|
|
|
|
namespace Infrastructure.Extensions
|
|
{
|
|
public static class HostEnvironmentEnvExtensions
|
|
{
|
|
public static void Debug(this IHostEnvironment hostEnvironment,string message)
|
|
{
|
|
if(hostEnvironment.IsDevelopment())
|
|
{
|
|
Console.WriteLine(message);
|
|
}
|
|
}
|
|
public static void Debug(this IHostEnvironment hostEnvironment, Exception ex)
|
|
{
|
|
if (hostEnvironment.IsDevelopment())
|
|
{
|
|
ex.PrintStack();
|
|
}
|
|
}
|
|
public static void Debug(this IHostEnvironment hostEnvironment, Func<string> getMessage)
|
|
{
|
|
if (hostEnvironment.IsDevelopment())
|
|
{
|
|
Console.WriteLine(getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|