blob: 970cc6c837d7877be92ad4105f59d03f98d64b7d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace Tango.Logging
{
/// <summary>
/// Represents a library logger for routing logs to the Visual Studio output window.
/// </summary>
public class VSOutputLogger : ILogger
{
private String _assembly_name;
/// <summary>
/// Initializes a new instance of the <see cref="VSOutputLogger"/> class.
/// </summary>
public VSOutputLogger()
{
Immediate = true;
Enabled = true;
_assembly_name = Assembly.GetEntryAssembly().GetName().Name + ": ";
}
/// <summary>
/// Called when a new library trace is available.
/// </summary>
/// <param name="output">The output.</param>
public void OnLog(LogItemBase output)
{
Debug.WriteLine(_assembly_name + output.ToString());
}
private bool _isEnabled;
/// <summary>
/// Gets or sets a value indicating whether this <see cref="ILogger" /> is enabled.
/// </summary>
public bool Enabled
{
get
{
return _isEnabled;
}
set
{
_isEnabled = value;
}
}
/// <summary>
/// Gets or sets a value indicating whether this <see cref="ILogger" /> will be notified about logs without waiting for the logs queue.
/// </summary>
public bool Immediate { get; set; }
}
}
|