 }
 
 
+/// A private console writer that facilitates synchronous output.
 private class LXSynchronousConsoleWriter: LXConsoleWriter {
+
+    /// The console's (stdout) file handle.
     private let stdoutHandle = NSFileHandle.fileHandleWithStandardOutput()
 
+    /// Clean up.
     deinit { self.stdoutHandle.closeFile() }
 
+    /// Writes the data to the console (stdout).
     private func writeData(data: NSData) {
         self.stdoutHandle.writeData(data)
     }

}


private class LXAsynchronousConsoleWriter: LXConsoleWriter {
    private func writeData(data: NSData) {
        guard let dispatchData = dispatch_data_create(data.bytes, data.length, nil, nil) else {
            assertionFailure("Failure to create data from entry string")

import Foundation


/// An internal protocol that facilitates `LXConsoleEndpoint` in operating either synchronously or asynchronously.
private protocol LXConsoleWriter {
    func writeData(data: NSData) -> Void
}


/// An endpoint that prints log entries to the console (stdout) in either a synchronous or asynchronous fashion.
public class LXConsoleEndpoint: LXEndpoint {
    public var minimumPriorityLevel: LXPriorityLevel
    public var dateFormatter: LXDateFormatter
    public var entryFormatter: LXEntryFormatter
    public let requiresNewlines: Bool = true

    /// The actual output engine.
    private let writer: LXConsoleWriter

    /**
    Initialize a console endpoint.
    
    A synchronous console endpoint will write each entry to the console before continuing with application execution, which makes
    debugging much easier. An asynchronous console endpoint may continue execution before every entry is written to the console,
    which will improve performance.
    
    - parameters:
      - synchronous: (optional) Indicates whether the application should wait for each message to be printed to the console
      before continuing execution. Defaults to `true`.
      - minimumPriorityLevel: (optional) Only log entries of this level or above will be written to this endpoint. Defaults to
      `All`.
      - dateFormatter: (optional) The date formatter that this endpoint will use to convert an entry's `dateTime` to a string.
      Defaults to `LXDateFormatter.standardFormatter()`.
      - entryFormatter: (optional) The entry formatter that this endpoint will use to convert an entry instnace to a string.
      Defaults to `LXEntryFormatter.standardFormatter()`.
    */
    public init(
        synchronous: Bool = true,
        minimumPriorityLevel: LXPriorityLevel = .All,
