Skip to content

Commit 9a5c4d1

Browse files
committed
basic diagnostics, logger next
1 parent bd46c81 commit 9a5c4d1

File tree

6 files changed

+115
-22
lines changed

6 files changed

+115
-22
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using System;
2+
3+
4+
namespace WriterSharp.PluginApi.Diagnostics
5+
{
6+
7+
/// <summary>
8+
/// A state reporter for the plugin.
9+
/// </summary>
10+
public interface IPluginReporter
11+
{
12+
13+
/// <summary>
14+
/// Reports an issue.
15+
/// </summary>
16+
/// <param name="issue">The description of the issue</param>
17+
/// <param name="severityLevel">The severity of the issue</param>
18+
void Report(string issue, SeverityLevel severityLevel = SeverityLevel.None);
19+
20+
/// <summary>
21+
/// Reports a missing dependency.
22+
/// </summary>
23+
/// <param name="dependency">The missing dependency's name</param>
24+
/// <param name="severityLevel">The severity level of the issue</param>
25+
void ReportMissingDependency(string dependency, SeverityLevel severityLevel = SeverityLevel.High);
26+
27+
/// <summary>
28+
/// Reports a performance issue.
29+
/// </summary>
30+
/// <param name="description">The description of the issue</param>
31+
/// <param name="expectedMs">An expected duration</param>
32+
/// <param name="actualMs">The actual duration</param>
33+
void ReportPerformanceIssue(string description, TimeSpan expectedMs, TimeSpan actualMs);
34+
35+
/// <summary>
36+
/// Reports a critical vulnerability.
37+
/// </summary>
38+
/// <param name="description">The description opf the vulnerability</param>
39+
void ReportVulnerability(string description);
40+
41+
}
42+
43+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
namespace WriterSharp.PluginApi.Diagnostics
2+
{
3+
4+
/// <summary>
5+
/// The severity level of a diagnosis/issue.
6+
/// </summary>
7+
public enum SeverityLevel
8+
{
9+
10+
/// <summary>
11+
/// No severity at all.
12+
/// </summary>
13+
None,
14+
15+
/// <summary>
16+
/// Information severity.
17+
/// </summary>
18+
Low,
19+
20+
/// <summary>
21+
/// Warning severity.
22+
/// </summary>
23+
Medium,
24+
25+
/// <summary>
26+
/// Error severity (non-critical).
27+
/// </summary>
28+
High,
29+
30+
/// <summary>
31+
/// Error severity (critical).
32+
/// </summary>
33+
Critical
34+
35+
}
36+
37+
}

WriterSharp.PluginApi/System/IFileSystem.cs renamed to WriterSharp.PluginApi/IO/IFileSystem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using System.Threading.Tasks;
44

55

6-
namespace WriterSharp.PluginApi.System
6+
namespace WriterSharp.PluginApi.IO
77
{
88

99
/// <summary>

WriterSharp.PluginApi/IPluginContext.cs

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
using WriterSharp.PluginApi.DependencyInjection;
2-
using WriterSharp.PluginApi.FileSystem;
3-
using WriterSharp.PluginApi.Resources;
1+
using WriterSharp.PluginApi.Diagnostics;
2+
using WriterSharp.PluginApi.IO;
43
using WriterSharp.PluginApi.Settings;
4+
using WriterSharp.PluginApi.Sharing;
55

66

77
namespace WriterSharp.PluginApi
@@ -13,12 +13,20 @@ namespace WriterSharp.PluginApi
1313
public interface IPluginContext
1414
{
1515

16-
// todo: add missing interfaces
16+
/// <summary>
17+
/// Manages commands that the user can call.
18+
/// </summary>
19+
ICommandManager Commands { get; }
1720

1821
/// <summary>
19-
/// The WriterSharp resource manager, for communication between plugins.
22+
/// Dependency container for WriterSharp.
2023
/// </summary>
21-
IResourceManager Resources { get; }
24+
IDependencyContainer Dependencies { get; }
25+
26+
/// <summary>
27+
/// Manages events related to WriterSharp.
28+
/// </summary>
29+
IEventManager Events { get; }
2230

2331
/// <summary>
2432
/// The sharded, recommended way for plugins to access
@@ -27,40 +35,45 @@ public interface IPluginContext
2735
IFileSystem FileSystem { get; }
2836

2937
/// <summary>
30-
/// Manages languages loaded into WriterSharp.
38+
/// Manages keyboard gestures loaded into WriterSharp.
3139
/// </summary>
32-
ILanguageManager Languages { get; }
40+
IGestureManager Gestures { get; }
3341

3442
/// <summary>
35-
/// Manages theming functionality loaded into
36-
/// WriterSharp.
43+
/// Reporter for issues, such as performance issues.
3744
/// </summary>
38-
IThemingManager Themes { get; }
45+
IPluginReporter IssueReporter { get; }
3946

4047
/// <summary>
41-
/// Manages events related to WriterSharp.
48+
/// Manages languages loaded into WriterSharp.
4249
/// </summary>
43-
IEventManager Events { get; }
50+
ILanguageManager Languages { get; }
4451

4552
/// <summary>
46-
/// Manages keyboard gestures loaded into WriterSharp.
53+
/// The WriterSharp logger.
4754
/// </summary>
48-
IGestureManager Gestures { get; }
55+
ILogger Logger { get; }
4956

5057
/// <summary>
51-
/// Manages commands that the user can call.
58+
/// The WriterSharp resource manager, for communication between plugins.
5259
/// </summary>
53-
ICommandManager Commands { get; }
60+
IResourceManager Resources { get; }
5461

5562
/// <summary>
5663
/// Manages plugin's settings via WriterSharp (for security).
5764
/// </summary>
5865
ISettingsManager Settings { get; }
5966

6067
/// <summary>
61-
/// Dependency injector for WriterSharp plugins.
68+
/// Manages theming functionality loaded into
69+
/// WriterSharp.
70+
/// </summary>
71+
IThemingManager Themes { get; }
72+
73+
/// <summary>
74+
/// Disables the plugin.
6275
/// </summary>
63-
IDependencyInjector Dependencies { get; }
76+
void Disable();
6477

6578
}
6679

WriterSharp.PluginApi/Sharing/IService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public interface IService
1010
/// <summary>
1111
/// Whether the service is available for public usage.
1212
/// </summary>
13-
bool IsAvailable { get; }
13+
bool IsAvailable { get; set; }
1414

1515
}
1616

docs/devlogs/archive/devlog1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Announcement
88
First Devlog
99
2 <- this means the previous button should not exist also only the first character from this line is read soo; a value of 3 means both buttons should be hidden
1010

11-
Welcome to the very first WriterSharp devlog - now hosted in WriterSharp's brand new site.
11+
Welcome to the very first WriterSharp devlog - now hosted in WriterSharp's brand-new site.
1212

1313
Yep, that's right, everyone! I've officially moved from the _tiny little section on my main site_ to a dedicated site just for WriterSharp. While still a work in progress - very much like the program itself - it allows me to connect, share updates and be transparent with those who are interested - or just curious - in WriterSharp's development and eventual release.
1414

0 commit comments

Comments
 (0)