public static void Main(string[] args) { MainConfig app = JsonFileParser.DeserializeFile <MainConfig> ("Config/MainConfig.json"); var cfg = new LoggingConfiguration(); var console = new ConsoleTarget(); console.Layout = @"${level} [${logger}] - ${message}"; cfg.AddTarget("console", console); LogLevel level = DetermineLogLevel(app.LogLevel); cfg.LoggingRules.Add(new LoggingRule("*", level, console)); LogManager.Configuration = cfg; Logger logger = LogManager.GetCurrentClassLogger(); var uri = String.Format("http://localhost:{0}", app.Port); var host = new NancyHost(new Uri(uri)); logger.Info("Listening on {0}", uri); host.Start(); logger.Info("Connecting to zookeeper and registering service..."); ZookeeperAccessor accessor = new ZookeeperAccessor(app.ZookeeperHost, app.ZookeeperPort); accessor.RegisterService("1.0", "location", app.Port, "/location"); accessor.RegisterService("1.0", "time", app.Port, "/time"); logger.Info("Service registration complete"); while (true) { } }
static LocationProvider() { Location = JsonFileParser.DeserializeFile <LocationConfig> ("Config/Location.json"); logger.Info("Location services initialized with address '{0}'", Location.Address); var locationService = new GoogleLocationService(); LatLong = locationService.GetLatLongFromAddress(Location.Address); logger.Info("Retrieved lat: {0} long: {1} from google", LatLong.Latitude, LatLong.Longitude); }