Created
September 3, 2016 17:43
-
-
Save Horusiath/660d12d51dd9382ecc43517d536900c2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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