Skip to content

goswinr/AvalonLog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo

AvalonLog

AvalonLog on nuget.org Build Status Docs Build Status license code size

AvalonLog is a fast and thread-safe WPF text log viewer for colored text. Including F# printf formatting. Based on AvalonEditB. Works on .NET Framework 4.7.2 and .NET 6.0

Thread-safe means that it can be called from any thread.

Fast means

  • it buffers repeated print calls and updates the view maximum 20 times per second. see source
  • Avalonedit is fast, the view is virtualized. It can easily handle thousands of lines.

Usage

Here an short example for F# interactive in .NET Framework. (for net9 you would have to use it in a project)

#r "PresentationCore"
#r "PresentationFramework"
#r "WindowsBase"

#r "nuget: AvalonLog"

open System.Windows

let log = new AvalonLog.AvalonLog() // The main class wrapping an Avalonedit TextEditor as append only log.

// create some printing functions by partial application:
let red   = log.printfColor 255 0 0  // without newline
let blue  = log.printfnColor 0 0 255 // with newline
let green = log.printfnColor 0 155 0 // with newline

// print to log using F# printf formatting
red   "Hello, "
blue  "World!"
red   "The answer"
green " is %d." (40 + 2)

Application().Run(Window(Content=log))  // show WPF window

this will produce

WPF window

For C# there is

public void AppendWithBrush(SolidColorBrush br, string s)

and similar functions on the AvalonLog instance.

Full API Documentation

goswinr.github.io/AvalonLog

Download

AvalonLog is available as NuGet package.

How to build

Just run dotnet build

Changelog

see CHANGELOG.md

License

MIT

Logo by LovePik

About

A thread-safe and colorful text viewer based on AvalonEdit

Topics

Resources

License

Stars

Watchers

Forks

Languages