Serilog.Sinks.AzureWebJobsTraceWriter 1.0.22

dotnet add package Serilog.Sinks.AzureWebJobsTraceWriter --version 1.0.22                
NuGet\Install-Package Serilog.Sinks.AzureWebJobsTraceWriter -Version 1.0.22                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Serilog.Sinks.AzureWebJobsTraceWriter" Version="1.0.22" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Serilog.Sinks.AzureWebJobsTraceWriter --version 1.0.22                
#r "nuget: Serilog.Sinks.AzureWebJobsTraceWriter, 1.0.22"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Serilog.Sinks.AzureWebJobsTraceWriter as a Cake Addin
#addin nuget:?package=Serilog.Sinks.AzureWebJobsTraceWriter&version=1.0.22

// Install Serilog.Sinks.AzureWebJobsTraceWriter as a Cake Tool
#tool nuget:?package=Serilog.Sinks.AzureWebJobsTraceWriter&version=1.0.22                

Serilog Azure WebJobs/Functions TraceWriter Sink

NuGet Version AppVeyor Coverage Status

A Serilog sink that writes events to Azure WebJob Host's TraceWriter. This is the logging mechanism used by both Azure WebJob's, and Azure Functions (which is built on top of the WebJob Host).

Getting started

Install the Serilog.Sinks.AzureWebJobsTraceWriter package from NuGet.

Within your logger configuration, you can now include a TraceWriter as a sink:

using Serilog.Sinks.AzureWebJobsTraceWriter;

ILogger log = new LoggerConfiguration()
    .WriteTo.TraceWriter(traceWriter)
    .CreateLogger();
    
log.Warning("This will be written to the TraceWriter");

Azure Functions Example

You will need to include the required Nuget packages within the functions project.json:

{
    "frameworks": {
        "net46": {
            "dependencies": {
                "Serilog": "2.4.0",
                "Serilog.Sinks.AzureWebJobsTraceWriter": "1.0.0",
                "Microsoft.Azure.WebJobs": "2.1.0"
            }
        }
    }
}

Then you can create a new logger within the scope of your function's static run method:

// This is required to point to the internal version of WebJobs.Host
#r "Microsoft.Azure.WebJobs.Host"

using System.Net;
using Serilog;
using Serilog.Sinks.AzureWebJobsTraceWriter;

public static string Run(HttpRequestMessage req, TraceWriter log)
{
    ILogger logger = new LoggerConfiguration()
                        .WriteTo.TraceWriter(log)
                        .CreateLogger();

    string someData = Guid.NewGuid().ToString();

    logger.Information("This is logging test for {someData}", someData);

    return $"Done with {someData}"; 
} 
Product Compatible and additional computed target framework versions.
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Serilog.Sinks.AzureWebJobsTraceWriter:

Repository Stars
sthewissen/Mynt
An Azure Functions-based crypto currency trading bot; featuring 10 exchanges, 25 indicators, custom strategy support, backtester and more
Version Downloads Last updated
1.0.22 221,977 8/14/2017
1.0.20 13,533 6/16/2017
1.0.12 1,785 6/16/2017