Open shargon opened 11 months ago
Wouldn't it be better to do this on neo-core
namespace Neo
{
public delegate void LogEventHandler(string source, LogLevel level, object message);
public static class Utility
{
internal class Logger : ReceiveActor
{
public Logger()
{
Receive<InitializeLogger>(_ => Sender.Tell(new LoggerInitialized()));
Receive<LogEvent>(e => Log(e.LogSource, (LogLevel)e.LogLevel(), e.Message));
}
}
public static event LogEventHandler Logging;
public static Encoding StrictUTF8 { get; }
static Utility()
{
StrictUTF8 = (Encoding)Encoding.UTF8.Clone();
StrictUTF8.DecoderFallback = DecoderFallback.ExceptionFallback;
StrictUTF8.EncoderFallback = EncoderFallback.ExceptionFallback;
}
public static object ConsoleLock { get; } = new(); // Add this line
public static void Log(string source, LogLevel level, object message)
{
lock (ConsoleLock) // Add this line
Logging?.Invoke(source, level, message);
}
}
}
Because the plugin you were talking about uses, Utility.Log
I did find this in neo-cli
; syncRoot
its for locking so you can sync root of console.
this can be closed. has one built-in
@shargon
I did find this in neo-cli; syncRoot its for locking so you can sync root of console.
Where is syncRoot?
But is private, how can be used in https://github.com/neo-project/neo-node/pull/905 ?
But we also use Console outside this repo, in plugins, we should have access to it
We can make it public and do something like https://github.com/neo-project/neo/issues/2995
problem solved? with https://github.com/neo-project/neo/issues/2995#issuecomment-1844875392
Currently we can receive from plugins some outputs that can be mixed with the entered command. We should be able to send these results together.
Related to https://github.com/neo-project/neo-node/pull/905#discussion_r1392224809
We need somthing like:
In order to allow
lock(ConsoleHelper.Lock){ ... multiple out ... }