default log to all requests logging python code example
Example 1: logging request
Logging
In many cases it can be useful to print the
response and/or request details in order to
help you create the correct expectations and
send the correct requests. To do help you do thi
s you can use one of the predefined filters
supplied with REST Assured or you can use one of the shortcuts.
Request Logging
given().log().all(). ..
Log all request specification details
including parameters, headers and body
given().log().params(). ..
given().log().body(). ..
given().log().headers(). ..
given().log().cookies(). ..
given().log().method(). ..
given().log().path(). ..
Example 2: from logging import logger
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import logging
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG)
logger.debug('Loging %s lewel', 'DEBUG')
logger.info('Loging %s lewel', 'INFO')
logger.warning('Loging %s lewel', 'WARN')
logger.error('Loging %s lewel', 'ERROR')
logger.critical('Loging %s lewel', 'CRITICAL')