Skip to content

Commit

Permalink
Merge pull request #24 from datalust/dev
Browse files Browse the repository at this point in the history
3.4.1 Release
  • Loading branch information
nblumhardt authored Nov 29, 2016
2 parents 7f50d50 + d00bf2f commit 9479f5d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 178 deletions.
40 changes: 25 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ It's useful for querying events and working with configuration data - *everythin

If you want to *write events* to Seq, use one of the logging framework clients, such as _Serilog.Sinks.Seq_ or _Seq.Client.Slab_ instead.

Getting Started
---------------
### Getting started

Install from NuGet:

Expand All @@ -35,8 +34,7 @@ var installedApps = await connection.Apps.ListAsync();

For a more complete example, see the [seq-tail app included in the source](https://github.com/continuousit/seq-api/blob/master/example/SeqTail/Program.cs);

Reading Events
--------------
### Reading events

Seq internally limits the resources a query is allowed to consume. The query methods on `SeqConnection.Events` include a _status_ with each result set - a `Partial` status indicates that further results must be retrieved.

Expand Down Expand Up @@ -76,8 +74,28 @@ foreach (var evt in resultSet)

All methods that retrieve events require a `count`. The API client defaults this value to `30` if not specified.

Working with the Basic Client
-----------------------------
### Streaming events

Seq 3.4 provides live streaming of events matching a filter and/or set of signals.

```csharp
var filter = "@Level = 'Error'";

using (var stream = await connection.Events.StreamAsync<JObject>(filter: filter))
using (stream.Select(jObject => LogEventReader.ReadFromJObject(jObject))
.Subscribe(evt => Log.Write(evt)))
{
await stream;
}
```

The `Events.StreamAsync()` method returns a hot `IObservable<T>` over a _WebSocket_. The observable will keep producing events until either it's disposed, or the server is shut down.

Seq streams the events in [compact JSON format](https://github.com/serilog/serilog-formatting-compact), which the Seq API client library can deserialize into JSON.NET `JObjects` for consumption.

[_Serilog.Formatting.Compact.Reader_](https://github.com/serilog/serilog-formatting-compact-reader) provides the `LogEventReader` class used above to turn these documents back into Serilog `LogEvent`s. Having the events represented in Serilog’s object model means they can be passed back into a logging pipeline, as performed above using `Log.Write()`.

### Working with the basic client

The `SeqApiClient` class implements the low level interactions with the API's entities and links. It's one step up from `System.Net.HttpClient` - you may be able to use it in cases not supported by the high-level wrapper.

Expand All @@ -94,7 +112,7 @@ var root = await client.GetRootAsync();
var events = await client.GetAsync<ResourceGroup>(root, "EventsResources");
```

(Available resource groups, like `events`, `users` and so-on, can be seen in the root document's `Links` collection.)
(Available resource groups, like `Events`, `Users` and so-on, can be seen in the root document's `Links` collection.)

Use the client to navigate links from entity to entity:

Expand All @@ -107,11 +125,3 @@ var matched = await client.List<EventEntity>(
foreach (var match in matched)
Console.WriteLine(matched.RenderedMessage);
```

Status
------

This library is under active development.

* The entity types etc. are complete: they're the same ones Seq uses internally.
* The helper classes such as `SeqConnection` and `SeqApiClient` are evolving and may change in response to feedback (and PRs!).
160 changes: 0 additions & 160 deletions src/Seq.Api/Seq.Api.csproj

This file was deleted.

6 changes: 3 additions & 3 deletions src/Seq.Api/project.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "3.4.0-*",
{
"version": "3.4.1-*",

"description": "Client library for the Seq HTTP API.",
"authors": [ "Datalust", "Contributors" ],
Expand Down Expand Up @@ -32,14 +32,14 @@
},

"dependencies": {
"NETStandard.Library": "1.6.0",
"Newtonsoft.Json": "9.0.1",
"Tavis.UriTemplates": "1.1.0"
},

"frameworks": {
"netstandard1.3": {
"dependencies": {
"NETStandard.Library": "1.6.0",
"System.Collections.Concurrent": "4.0.12",
"System.Net.Http": "4.1.0",
"System.Net.WebSockets.Client": "4.0.0"
Expand Down

0 comments on commit 9479f5d

Please sign in to comment.