private static async Task <LogMessage> CreateLogEntry(string uri, OpenLoggingClient cl2) { Writeline("Creating Log Message Entry ..."); var logRes = await cl2.NewLogEntryAsync(new LogMessage() { Title = "New Log MEssage" + DateTime.Now, Category = "ERROR", Body = "Body of " + DateTime.Now, Message = "This is the dang message", DateOfExpiration = DateTimeOffset.Now.AddMinutes(1) }); return(logRes); }
static async Task <LogMessage> dostuff() { // Production URL string uri = "http://openlogger.azurewebsites.net/api"; // "openlogger" hostname used below is so that we can debug with Fidder; this requires // updates to the CustomRules of Fiddler. // See http://codebetter.com/howarddierking/2011/05/09/getting-fiddler-and-the-net-framework-to-play-better-together-2/ for usage // Uncomment this line when using Fiddler (and set up as above) uri = "http://openlogger/api/"; // Uncomment this line when not using Fiddler // uri = "http://localhost:60757/api/"; // This ID must already exist Guid accountApiKey = new Guid("90a1de78-cd4d-4b7e-a356-7e6e3fb01be3"); OpenLoggingAccountClient acctClient = new OpenLoggingAccountClient(accountApiKey, new Uri(uri)); var client = acctClient.CreateClient(new Models.Client() { ClientName = "The Test Client" }); OpenLoggingClient logClient = new OpenLoggingClient(client.CurrentApiKey, new Uri(uri)); var entry = logClient.NewLogEntry(new LogMessage() { Title = "The Test Log Entry", Message = "This is the message", Category = "INFO", Body = "This is the extended description", DateOfEvent = DateTimeOffset.Now.AddSeconds(-25) }); Writeline("All created. ENTER to Delete"); Readline(); acctClient.DeleteClient(client); return(entry); }