Skip to content

Commit df69e81

Browse files
committed
fix: reorder readme
1 parent 0812595 commit df69e81

File tree

1 file changed

+40
-28
lines changed

1 file changed

+40
-28
lines changed

README.md

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ Install-Package Serilog.UI
1515

1616
Then install one of the providers based upon your sink:
1717

18-
| Provider Name | Install | Package |
19-
| ------------------------------ | ------------------------------------------------ | ------------------------------------------------------------------------------ |
20-
| Serilog.UI.MsSqlServerProvider | `Install-Package Serilog.UI.MsSqlServerProvider` | [NuGet package](https://www.nuget.org/packages/Serilog.UI.MsSqlServerProvider) |
21-
| Serilog.UI.MySqlProvider | `Install-Package Serilog.UI.MySqlProvider` | [NuGet package](https://www.nuget.org/packages/Serilog.UI.MySqlProvider) |
22-
| Serilog.UI.PostgreSqlProvider | `Install-Package Serilog.UI.PostgreSqlProvider` | [NuGet package](https://www.nuget.org/packages/Serilog.UI.PostgreSqlProvider) |
23-
| Serilog.UI.MongoDbProviderr | `Install-Package Serilog.UI.MongoDbProvider` | [NuGet package](https://www.nuget.org/packages/Serilog.UI.MongoDbProvider) |
18+
| Provider Name | Install | Package |
19+
| -------------------------------- | ------------------------------------------------- | -------------------------------------------------------------------------------- |
20+
| Serilog.UI.MsSqlServerProvider | `Install-Package Serilog.UI.MsSqlServerProvider` | [NuGet package](https://www.nuget.org/packages/Serilog.UI.MsSqlServerProvider) |
21+
| Serilog.UI.MySqlProvider | `Install-Package Serilog.UI.MySqlProvider` | [NuGet package](https://www.nuget.org/packages/Serilog.UI.MySqlProvider) |
22+
| Serilog.UI.PostgreSqlProvider | `Install-Package Serilog.UI.PostgreSqlProvider` | [NuGet package](https://www.nuget.org/packages/Serilog.UI.PostgreSqlProvider) |
23+
| Serilog.UI.MongoDbProviderr | `Install-Package Serilog.UI.MongoDbProvider` | [NuGet package](https://www.nuget.org/packages/Serilog.UI.MongoDbProvider) |
2424
| Serilog.UI.ElasticSearchProvider | `Install-Package Serilog.UI.ElasticSearcProvider` | [NuGet package](https://www.nuget.org/packages/Serilog.UI.ElasticSearchProvider) |
2525

2626
Then, add `AddSerilogUi()` to `IServiceCollection` in `Startup.ConfigureServices` method:
@@ -58,12 +58,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
5858
}
5959
```
6060

61-
The default url to view the log page is `http://<your-app>/serilog-ui`. If you want to change this url path, just configure the route prefix:
62-
```csharp
63-
app.UseSerilogUi(option => option.RoutePrefix = "logs");
64-
```
65-
66-
**Authorization configuration required**
61+
## Authorization: configuration
6762

6863
By default serilog-ui allows access to the log page only for local requests. In order to give appropriate rights for production use, you need to configure authorization. You can secure the log page by allowing specific users or roles to view logs:
6964

@@ -78,30 +73,39 @@ public void ConfigureServices(IServiceCollection services)
7873
authOptions.Roles = new[] { "AdminRole" };
7974
})
8075
.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"), "LogTableName"));
81-
.
82-
.
83-
.
76+
// ...
77+
}
8478
```
85-
Only `User1` and `User2` or users with `AdminRole` role can view logs. If you set `AuthenticationType` to `Jwt`, you can set a jwt token and an `Authorization` header will be added to the request and for `Cookie` just login into you website and no extra step is required.
79+
Only `User1` and `User2` or users with `AdminRole` role can view logs.
80+
81+
If you set `AuthenticationType` to `Jwt`, you can set a jwt token and an `Authorization` header will be added to the request and for `Cookie` just login into you website and no extra step is required.
8682

87-
To disable access for local requests, (e.g. for testing authentication locally) set `AlwaysAllowLocalRequests` to `false`.
83+
To disable anonymous access for local requests, (e.g. for testing authentication locally) set `AlwaysAllowLocalRequests` to `false`.
84+
85+
To disable authorization on production, set `Enabled` to false.
8886

8987
``` csharp
9088
services.AddSerilogUi(options => options
9189
.EnableAuthorization(authOption =>
9290
{
93-
authOption.AlwaysAllowLocalRequests = false;
91+
authOption.AlwaysAllowLocalRequests = false; // disable anonymous access on local
92+
authOption.Enabled = false; // disable authorization access check on production
9493
})
9594
.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"), "Logs"));
9695
```
9796

98-
## Limitations
99-
* Additional columns are not supported and only main columns can be retrieved.
100-
10197
## Options
10298
Options can be found in the [UIOptions](src/Serilog.Ui.Web/Extensions/UiOptions.cs) class.
10399
`internal` properties can generally be set via extension methods, see [SerilogUiOptionBuilderExtensions](src/Serilog.Ui.Web/Extensions/SerilogUiOptionBuilderExtensions.cs)
104100

101+
### Log page URL
102+
103+
The default url to view the log page is `http://<your-app>/serilog-ui`. If you want to change this url path, just configure the route prefix:
104+
105+
```csharp
106+
app.UseSerilogUi(option => option.RoutePrefix = "logs");
107+
```
108+
105109
### Home url
106110
![image](https://user-images.githubusercontent.com/8641495/185874822-1d4b6f52-864c-4ffb-9064-6fc5ee9a079c.png)
107111

@@ -114,10 +118,14 @@ app.UseSerilogUi(options =>
114118
});
115119
```
116120

117-
### Custom Javascript and CSS
121+
### Inject custom Javascript and CSS
122+
123+
For customization of the dashboard UI, custom JS and CSS can be injected.
124+
125+
CSS gets injected in the `<head>` element.
126+
127+
JS gets injected at the end of the `<body>` element by default.
118128

119-
For customization of the dashboard UI custom JS and CSS can be injected.
120-
CSS gets injected in the `<head>` element. JS gets injected at the end of the `<body>` element by default.
121129
To inject JS in the `<head>` element set `injectInHead` to `true`.
122130

123131
``` csharp
@@ -138,6 +146,7 @@ app.UseStaticFiles();
138146
```
139147

140148
With the default configuration static files are served under the wwwroot folder, so in the example above the file structure should be:
149+
141150
![image](https://user-images.githubusercontent.com/8641495/185877921-99aaf19a-3e62-4ad9-85c3-47994e7e6ba1.png)
142151

143152
JS code can be ran when loading the file by wrapping the code in a function, and directly running that function like so:
@@ -147,7 +156,7 @@ JS code can be ran when loading the file by wrapping the code in a function, and
147156
})();
148157
```
149158

150-
## serilog-ui UI frontend development
159+
## UI: Frontend development
151160

152161
The serilog-ui frontend is located inside the Serilog.Ui.Web package.
153162

@@ -203,9 +212,12 @@ There are two Grunt tasks you can use to build the frontend project:
203212
- you should be able to run the dev environment on both localhost and 127.0.0.1 (to check if it's working fine, open the console: you'll find a red message: **"[MSW] Mocking enabled."**)
204213
</details>
205214

206-
## Test
215+
# Known Limitations
216+
* Additional columns are not supported and only main columns can be retrieved.
217+
218+
# Test
207219

208-
### .NET Serilog.UI Projects
220+
## .NET Serilog.UI Projects
209221

210222
The test projects are located inside the */tests* folder.
211223

@@ -220,7 +232,7 @@ To run the tests, use Test Explorer in Visual Studio or run from the root folder
220232
dotnet test
221233
```
222234

223-
### JS UI assets
235+
## JS UI assets
224236

225237
Tests are located inside src/Serilog.Ui.Web/assets/__tests__
226238

0 commit comments

Comments
 (0)