Getting Hold of Suave's Logs

Current documentation for configuring Suave is either in this sample or in the Logary readme.

The below details how to configure Suave v1.x with Logary v3.x:

When you are using suave you will probably want to funnel all logs from the output to your own log sink. We provide the interface Logger to do that; just set the propery logger in the configuration to an instance of your thread-safe logger. An example:

type MyHackLogger(minLevel) = interface Logger with member x.Log level fLine = if level >= minLevel then // don't do this for real ;) System.Windows.Forms.MessageBox.Show((fLine ()).message)

You can use Logary for integrated logging:

Install-Package Logary.Adapters.Suave

Use the SuaveAdapter type to set the Logger in Suave's configuration:

open Suave.Logging use logary = withLogary' "logibit.web" ( withTargets [ Console.create Console.empty "console" Debugger.create Debugger.empty "debugger" ] >> withMetrics (Duration.FromMilliseconds 5000L) [ WinPerfCounters.create (WinPerfCounters.Common.cpuTimeConf) "wperf" (Duration.FromMilliseconds 300L) ] >> withRules [ Rule.createForTarget "console" Rule.createForTarget "debugger" ] ) let webConfig = { defaultConfig with logger = SuaveAdapter(logary.GetLogger "suave") }
Multiple items
type MyHackLogger =
  interface Logger
  new : minLevel:IComparable -> MyHackLogger
  override Log : level:IComparable -> fLine:'a -> unit

Full name: temp.MyHackLogger

--------------------
new : minLevel:System.IComparable -> MyHackLogger
val minLevel : System.IComparable
type Logger =
  interface
    abstract member name : string []
    abstract member log : LogLevel -> (LogLevel -> Message) -> Async<unit>
    abstract member logWithAck : LogLevel -> (LogLevel -> Message) -> Async<unit>
  end

Full name: Suave.Logging.Logger
val x : MyHackLogger
Multiple items
override MyHackLogger.Log : level:System.IComparable -> fLine:'a -> unit

Full name: temp.MyHackLogger.Log

--------------------
module Log

from Suave.Logging
val level : System.IComparable
val fLine : 'a
namespace System
namespace System.Windows
namespace System.Windows.Forms
type MessageBox =
  static member Show : text:string -> DialogResult + 20 overloads

Full name: System.Windows.Forms.MessageBox
System.Windows.Forms.MessageBox.Show(text: string) : System.Windows.Forms.DialogResult
   (+0 other overloads)
System.Windows.Forms.MessageBox.Show(text: string, caption: string) : System.Windows.Forms.DialogResult
   (+0 other overloads)
System.Windows.Forms.MessageBox.Show(owner: System.Windows.Forms.IWin32Window, text: string) : System.Windows.Forms.DialogResult
   (+0 other overloads)
System.Windows.Forms.MessageBox.Show(owner: System.Windows.Forms.IWin32Window, text: string, caption: string) : System.Windows.Forms.DialogResult
   (+0 other overloads)
System.Windows.Forms.MessageBox.Show(text: string, caption: string, buttons: System.Windows.Forms.MessageBoxButtons) : System.Windows.Forms.DialogResult
   (+0 other overloads)
System.Windows.Forms.MessageBox.Show(text: string, caption: string, buttons: System.Windows.Forms.MessageBoxButtons, icon: System.Windows.Forms.MessageBoxIcon) : System.Windows.Forms.DialogResult
   (+0 other overloads)
System.Windows.Forms.MessageBox.Show(owner: System.Windows.Forms.IWin32Window, text: string, caption: string, buttons: System.Windows.Forms.MessageBoxButtons) : System.Windows.Forms.DialogResult
   (+0 other overloads)
System.Windows.Forms.MessageBox.Show(text: string, caption: string, buttons: System.Windows.Forms.MessageBoxButtons, icon: System.Windows.Forms.MessageBoxIcon, defaultButton: System.Windows.Forms.MessageBoxDefaultButton) : System.Windows.Forms.DialogResult
   (+0 other overloads)
System.Windows.Forms.MessageBox.Show(owner: System.Windows.Forms.IWin32Window, text: string, caption: string, buttons: System.Windows.Forms.MessageBoxButtons, icon: System.Windows.Forms.MessageBoxIcon) : System.Windows.Forms.DialogResult
   (+0 other overloads)
System.Windows.Forms.MessageBox.Show(text: string, caption: string, buttons: System.Windows.Forms.MessageBoxButtons, icon: System.Windows.Forms.MessageBoxIcon, defaultButton: System.Windows.Forms.MessageBoxDefaultButton, options: System.Windows.Forms.MessageBoxOptions) : System.Windows.Forms.DialogResult
   (+0 other overloads)
namespace Suave
namespace Suave.Logging
val logary : obj

Full name: temp.logary
val webConfig : SuaveConfig

Full name: temp.webConfig
val defaultConfig : SuaveConfig

Full name: Suave.Web.defaultConfig

results matching ""

    No results matching ""