2
// Copyright (c) 2007 James Newton-King
4
// Permission is hereby granted, free of charge, to any person
5
// obtaining a copy of this software and associated documentation
6
// files (the "Software"), to deal in the Software without
7
// restriction, including without limitation the rights to use,
8
// copy, modify, merge, publish, distribute, sublicense, and/or sell
9
// copies of the Software, and to permit persons to whom the
10
// Software is furnished to do so, subject to the following
13
// The above copyright notice and this permission notice shall be
14
// included in all copies or substantial portions of the Software.
16
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
// OTHER DEALINGS IN THE SOFTWARE.
28
namespace Newtonsoft.Json.Tests.TestObjects
31
/// What types of events are there? Just sticking to a basic set of four for now.
33
/// <remarks></remarks>
42
public sealed class Event
46
/// If no current user is specified, returns Nothing (0 from VB)
48
/// <returns></returns>
49
/// <remarks></remarks>
50
private static int GetCurrentUserId()
56
/// Gets either the application path or the current stack trace.
57
/// NOTE: You MUST call this from the top level entry point. Otherwise,
58
/// the stack trace will be buried in Logger itself.
60
/// <returns></returns>
61
/// <remarks></remarks>
62
private static string GetCurrentSubLocation()
67
private string _sublocation;
69
private EventType _type;
70
private string _summary;
71
private string _details;
72
private string _stackTrace;
74
private DateTime _time;
76
public Event(string summary)
81
if (_userId == 0) _userId = GetCurrentUserId();
82
//This call only works at top level for now.
83
//If _stackTrace = Nothing Then _stackTrace = Environment.StackTrace
84
if (_sublocation == null) _sublocation = GetCurrentSubLocation();
87
public Event(string sublocation, int userId, EventType type, string summary, string details, string stackTrace, string tag)
89
_sublocation = sublocation;
94
_stackTrace = stackTrace;
98
if (_userId == 0) _userId = GetCurrentUserId();
99
//If _stackTrace = Nothing Then _stackTrace = Environment.StackTrace
100
if (_sublocation == null) _sublocation = GetCurrentSubLocation();
103
public override string ToString()
105
return string.Format("{{ sublocation = {0}, userId = {1}, type = {2}, summary = {3}, details = {4}, stackTrace = {5}, tag = {6} }}", _sublocation, _userId, _type, _summary, _details, _stackTrace, _tag);
108
public string sublocation
110
get { return _sublocation; }
111
set { _sublocation = value; }
115
get { return _userId; }
116
set { _userId = value; }
118
public EventType type
120
get { return _type; }
121
set { _type = value; }
123
public string summary
125
get { return _summary; }
126
set { _summary = value; }
128
public string details
130
get { return _details; }
131
set { _details = value; }
133
public string stackTrace
135
get { return _stackTrace; }
136
set { _stackTrace = value; }
141
set { _tag = value; }
145
get { return _time; }
b'\\ No newline at end of file'