com.jayway.restassured.config
Class LogConfig

java.lang.Object
  extended by com.jayway.restassured.config.LogConfig

public class LogConfig
extends Object

Configure the logging for REST Assured.

Note that only log things known to REST Assured (i.e. the request- and response specifications) will be logged. If you need to log what's actually sent on the wire refer to the HTTP Client logging docs or use an external tool such as Wireshark.


Constructor Summary
LogConfig()
          Configure the default stream to use the System.out stream (default).
LogConfig(PrintStream defaultPrintStream, boolean prettyPrintingEnabled)
          Configure pretty printing and the default stream where logs should be written if not specified explicitly by a filter.
 
Method Summary
 LogConfig and()
          Syntactic sugar.
 PrintStream defaultStream()
           
 LogConfig defaultStream(PrintStream printStream)
          Specify a new default stream to the print to.
 LogConfig enablePrettyPrinting(boolean shouldEnable)
          Specify a whether or not to enable pretty printing by default.
 boolean isPrettyPrintingEnabled()
           
static LogConfig logConfig()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogConfig

public LogConfig()
Configure the default stream to use the System.out stream (default).


LogConfig

public LogConfig(PrintStream defaultPrintStream,
                 boolean prettyPrintingEnabled)
Configure pretty printing and the default stream where logs should be written if not specified explicitly by a filter. I.e. this stream will be used in cases where the log specification DSL is used, e.g.
 given().log().all()...
 
or
 expect().log.ifError(). ..
 
It will not override explicit streams defined by using the RequestLoggingFilter or the ResponseLoggingFilter.

Parameters:
defaultPrintStream - The default print stream to use for the LogSpecification's.
prettyPrintingEnabled - Enable or disable pretty printing when logging. Pretty printing is only possible when content-type is XML, JSON or HTML.
Method Detail

defaultStream

public PrintStream defaultStream()
Returns:
The default stream to use

defaultStream

public LogConfig defaultStream(PrintStream printStream)
Specify a new default stream to the print to.

Parameters:
printStream - The stream
Returns:
A new LogConfig instance

isPrettyPrintingEnabled

public boolean isPrettyPrintingEnabled()
Returns:
The default stream to use

enablePrettyPrinting

public LogConfig enablePrettyPrinting(boolean shouldEnable)
Specify a whether or not to enable pretty printing by default.

Parameters:
shouldEnable - true if pretty-printing should be enabled, false otherwise.
Returns:
A new LogConfig instance

logConfig

public static LogConfig logConfig()
Returns:
A static way to create a new LogConfig instance without calling "new" explicitly. Mainly for syntactic sugar.

and

public LogConfig and()
Syntactic sugar.

Returns:
The same log config instance.


Copyright © 2010-2012. All Rights Reserved.