Comments (5)
only console.write reference is in the demo project? are you sure the log lines you mention are from uhttpsharp?
from uhttpsharp.
This one, for example:
uhttpsharp/uhttpsharp/HttpServer.cs
Line 66 in e3ac7fc
from uhttpsharp.
Bump! I would really love to know how to disable this annoying message every time I use the library:
Exception occured resolving a log provider. Logging for this assembly uhttpsharp
, Version=0.1.5653.28566, Culture=neutral, PublicKeyToken=null is disabled. Syst
em.TypeInitializationException: The type initializer for 'uhttpsharp.Logging.Log
Providers.ColouredConsoleLogProvider' threw an exception. ---> System.InvalidOpe
rationException: System.Console or System.ConsoleColor type not found
at uhttpsharp.Logging.LogProviders.ColouredConsoleLogProvider..cctor() in c:
Users\shani\Documents\GitHub\uHttpSharp\uhttpsharp\App_Packages\LibLog.3.1\LibLo
g.cs:line 1629
--- End of inner exception stack trace ---
at uhttpsharp.Logging.LogProviders.ColouredConsoleLogProvider.IsLoggerAvailab
le() in c:\Users\shani\Documents\GitHub\uHttpSharp\uhttpsharp\App_Packages\LibLo
g.3.1\LibLog.cs:line 1645
at uhttpsharp.Logging.LogProvider.ResolveLogProvider() in c:\Users\shani\Docu
ments\GitHub\uHttpSharp\uhttpsharp\App_Packages\LibLog.3.1\LibLog.cs:line 453
Why can't you just let the exception bubble up so I can catch it?
from uhttpsharp.
Do this for a work around:
static YourClass()
{
LogProvider.LogProviderResolvers.Add(
new Tuple<LogProvider.IsLoggerAvailable, LogProvider.CreateLogProvider>(() => true,
() => NullLoggerProvider.Instance));
}
public class NullLoggerProvider : ILogProvider
{
public static readonly NullLoggerProvider Instance = new NullLoggerProvider();
private static readonly ILog NullLogInstance = new NullLog();
public ILog GetLogger(string name)
{
return NullLogInstance;
}
public IDisposable OpenNestedContext(string message)
{
return null;
}
public IDisposable OpenMappedContext(string key, string value)
{
return null;
}
public class NullLog : ILog
{
public bool Log(LogLevel logLevel, Func<string> messageFunc, Exception exception = null, params object[] formatParameters)
{
// do nothing
return true;
}
}
}
from uhttpsharp.
same issue. Workaround didn't work.
from uhttpsharp.
Related Issues (15)
- Support for Post Data HOT 1
- Is ist possible to have a login? HOT 1
- Source for SessionHandler is not available in github
- How to add handler for new HTTP method?
- License confusion HOT 1
- Host static project in response
- [HELP] SSL garbage date
- Two repo,Refused HOT 2
- sockets end in close_wait state after some time HOT 1
- examples?
- Example doesn't work
- deleted
- Remove dependencies? HOT 1
- Unable to run demo with HTTPS enabled.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uhttpsharp.