         }
         return FlexFormatter(parts: formatSpec)
     }
-
+    
     public func description() -> String {
         var desc = ""
         for (index, part) in enumerate(format) {

        }
        return "FlexFormatter with \(desc)"
    }
 
}


        //}
    }
    
    /// This overload is needed (as of Beta 3) because
    /// passing an array to a variadic param is not yet supported
    init(parts: [FlexFormatterPart]) {
        format = parts
    }
    
    
    func getFunctionFormat(function: String) -> String {
        var result = function;
        if (result.hasPrefix("Optional(")) {
            let len = countElements("Optional(")
            let start = advance(result.startIndex, len)
            let end = advance(result.endIndex, -len)
            let range = start..<end
            result = result[range]
        }
        if (!result.hasSuffix(")")) {
            result = result + "()"
        }
        return result
    }
    
    public func formatLog<T>(logger: Logger, level: LogLevel, message givenMessage: @autoclosure() -> T,
        filename: String?, line: Int?,  function: String?) -> String {
            var logMessage = ""
            for (index, part) in enumerate(format) {
                switch part {
                case .MESSAGE:
                    let message = givenMessage()
                    logMessage += "\(message)"
                case .NAME: logMessage += logger.name
                case .LEVEL: logMessage += level.label
                case .DATE: logMessage += NSDate().description
                case .LINE:
                    if (filename != nil) && (line != nil) {
                        logMessage += "[\(filename!.lastPathComponent):\(line!)]"
                    }
                case .FUNC:
                    if (function != nil) {
                        let output = getFunctionFormat(function!)
                        logMessage += "[\(output)]"
                    }
                }
                
                if (index < format.count-1) {
                    if (format[index+1] == .MESSAGE) {
                        logMessage += ":"
                    }
                    logMessage += " "
                }
            }
            return logMessage
    }
    
    
    public class func logFormatterForString(formatString: String) -> LogFormatter {
        var formatSpec = [FlexFormatterPart]()
        let parts = formatString.uppercaseString.componentsSeparatedByCharactersInSet(NSCharacterSet.whitespaceCharacterSet())
