Feature/timestamp messages (#68)

* added support for timestamps

* fixed tests

* Moved message class to own file; added 'z' to end of date strings

* added default time constructor

* removed unnecessary z

* added time string format info in comment

* changed from utc time to using local time
This commit is contained in:
Anthony Dresser
2016-09-30 11:46:32 -07:00
committed by GitHub
parent 3f77e14347
commit d451447ebc
5 changed files with 59 additions and 14 deletions

View File

@@ -0,0 +1,44 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts
{
/// <summary>
/// Result message object with timestamp and actual message
/// </summary>
public class ResultMessage
{
/// <summary>
/// Timestamp of the message
/// Stored in UTC ISO 8601 format; should be localized before displaying to any user
/// </summary>
public string Time { get; set; }
/// <summary>
/// Message contents
/// </summary>
public string Message { get; set; }
/// <summary>
/// Full constructor
/// </summary>
public ResultMessage(string timeStamp, string message)
{
Time = timeStamp;
Message = message;
}
/// <summary>
/// Constructor with default "Now" time
/// </summary>
public ResultMessage(string message)
{
Time = DateTime.Now.ToString("o");
Message = message;
}
}
}