Skip to content

Instantly share code, notes, and snippets.

@Horusiath
Created September 3, 2016 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Horusiath/660d12d51dd9382ecc43517d536900c2 to your computer and use it in GitHub Desktop.
Save Horusiath/660d12d51dd9382ecc43517d536900c2 to your computer and use it in GitHub Desktop.
public class MyActor : ReceiveActor
{
public MyActor()
{
Receive<Debug>(e => Log(e.ToString()));
Receive<Info>(e => Log(e.ToString()));
Receive<Warning>(e => Log(e.ToString()));
Receive<Error>(e => Log(e.ToString()));
Receive<InitializeLogger>(_ => Sender.Tell(new LoggerInitialized()));
}
private void Log(string s)
{
Console.WriteLine(s);
}
protected override void PostStop()
{
Console.Write("-----I'M DYING!!!------");
base.PostStop();
}
}
class Program
{
static void Main(string[] args)
{
using (var system = ActorSystem.Create("sys", ConfigurationFactory.ParseString(@"
akka.loggers = [ ""Akka.Testing.MyActor, Akka.Testing"" ]")))
{
Console.ReadLine();
}
Console.ReadLine();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment