Module Expr Str ImportFrom alias ImportFrom alias alias alias alias ImportFrom alias alias ImportFrom alias ImportFrom alias Import alias FunctionDef arguments args NameParam NameParam NameParam defaults body If CompareIn NameLoad TupleLoad Str Str body Assign NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad kwarg body Expr Str If BoolOpOr UnaryOpNot NameLoad CompareEq NameLoad Str body Assign NameStore Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call NameLoad keyword NameLoad keyword NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad Return Call AttributeLoad NameLoad attr NameLoad decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad NameLoad kwarg body Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str Str Assign NameStore Call AttributeLoad NameLoad attr Str Str Return Call NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Expr Str For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body If CompareNotIn NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad keyword NameLoad decorator_list NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assert AttributeLoad NameLoad attr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr ListLoad Str Str Str For NameStore AttributeLoad AttributeLoad NameLoad attr attr body Assign NameStore SubscriptLoad NameLoad Index Str If CompareEq NameLoad Str body Assign NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str Assign NameStore SubscriptLoad NameLoad Index Str Expr Call NameLoad NameLoad NameLoad NameLoad decorator_list Call NameLoad Str FunctionDef arguments args NameParam defaults body Expr Str Assert AttributeLoad NameLoad attr Str Assert CompareEq Call NameLoad AttributeLoad AttributeLoad NameLoad attr attr Num Str Expr Call NameLoad NameLoad decorator_list Call NameLoad Str FunctionDef arguments args NameParam defaults body Assert AttributeLoad NameLoad attr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr ListLoad Str Str Str Assert CompareEq Call NameLoad AttributeLoad AttributeLoad NameLoad attr attr Num BinOpMod Str Call NameLoad AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Assign NameStore Call NameLoad keyword SubscriptLoad NameLoad Index Str keyword SubscriptLoad NameLoad Index Str keyword SubscriptLoad NameLoad Index Str Assign AttributeStore NameLoad attr NameLoad decorator_list Call NameLoad Str FunctionDef arguments args NameParam defaults body Expr Str Assert AttributeLoad NameLoad attr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr ListLoad Str Str Str Assign NameStore Call NameLoad NameLoad Str AttributeLoad AttributeLoad NameLoad attr attr For NameStore AttributeLoad AttributeLoad NameLoad attr attr body Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr keyword NameLoad decorator_list Call NameLoad Str FunctionDef arguments args NameParam defaults body Expr Str Assert AttributeLoad NameLoad attr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr ListLoad Str Str Str Assign NameStore Call NameLoad NameLoad Str AttributeLoad AttributeLoad NameLoad attr attr For NameStore AttributeLoad AttributeLoad NameLoad attr attr body Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr keyword NameLoad decorator_list Call NameLoad Str FunctionDef arguments args NameParam defaults body Assert AttributeLoad NameLoad attr Str Assert CompareEq Call NameLoad AttributeLoad AttributeLoad NameLoad attr attr Num Str Expr Call NameLoad NameLoad decorator_list Call NameLoad Str FunctionDef arguments args NameParam defaults body Assert AttributeLoad NameLoad attr Str Assert CompareEq Call NameLoad AttributeLoad AttributeLoad NameLoad attr attr Num Str Expr Call NameLoad NameLoad decorator_list Call NameLoad Str FunctionDef arguments args NameParam defaults body Expr Str Assert AttributeLoad NameLoad attr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Assign NameStore AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Expr Call NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr ListLoad Str Str decorator_list Call NameLoad Str FunctionDef arguments args NameParam defaults body Expr Str Assert AttributeLoad NameLoad attr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Assign NameStore AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Expr Call NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr ListLoad Str Str decorator_list Call NameLoad Str FunctionDef arguments args NameParam NameParam defaults body Expr Str Assert AttributeLoad NameLoad attr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr ListLoad Str Str Str Assign NameStore Call NameLoad NameLoad Str AttributeLoad AttributeLoad NameLoad attr attr For NameStore AttributeLoad AttributeLoad NameLoad attr attr body Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call NameLoad NameLoad NameLoad decorator_list Call NameLoad Str FunctionDef arguments args NameParam NameParam defaults body Expr Str Assert AttributeLoad NameLoad attr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr ListLoad Str Str Str Assign NameStore Call NameLoad NameLoad Str AttributeLoad AttributeLoad NameLoad attr attr For NameStore AttributeLoad AttributeLoad NameLoad attr attr body Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call NameLoad NameLoad NameLoad decorator_list Call NameLoad Str FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad decorator_list Call NameLoad Str FunctionDef arguments args NameParam defaults body Expr Str Assert AttributeLoad NameLoad attr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr ListLoad Str Str For NameStore AttributeLoad AttributeLoad NameLoad attr attr body Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore SubscriptLoad NameLoad Index Str If CompareEq NameLoad Str body Assign AttributeStore NameLoad attr NameLoad orelse If CompareEq NameLoad Str body Assign AttributeStore NameLoad attr NameLoad orelse Raise Call NameLoad BinOpMod Str NameLoad decorator_list Call NameLoad Str FunctionDef arguments args NameParam NameParam defaults body Raise Call NameLoad decorator_list Call NameLoad Str FunctionDef arguments args NameParam defaults body Expr Str Raise Call NameLoad Assign NameStore Call NameLoad NameLoad Str NameLoad If UnaryOpNot NameLoad body Assign AttributeStore NameLoad attr Call NameLoad decorator_list Call NameLoad Str
N/A N/A 
Provides step definitions to perform tests with the Python logging subsystem.

.. code-block: gherkin

    Given I create log records with:
        | category | level   | message |
        | foo.bar  | WARN    | Hello LogRecord |
        | bar      | CURRENT | Hello LogRecord |
    And I create a log record with:
        | category | level   | message |
        | foo      | ERROR   | Hello Foo |
    Then the command output should contain the following log records:
        | category | level   | message |
        | bar      | CURRENT | xxx     |
    Then the command output should not contain the following log records:
        | category | level   | message |
        | bar      | CURRENT | xxx     |
    Then the file "behave.log" should contain the log records:
        | category | level   | message |
        | bar      | CURRENT | xxx     |
    Then the file "behave.log" should not contain the log records:
        | category | level   | message |
        | bar      | CURRENT | xxx     |

    Given I define the log record schema:
        | category | level   | message |
        | root     | INFO    | Hello LogRecord |
    And I create log records with:
        | category | level   | message |
        | foo.bar  | INFO    | Hello LogRecord |
        | bar      | INFO    | Hello LogRecord |
    Then the command output should contain log records from categories
        | category |
        | foo.bar  |
        | bar      |

    Given I use the log record configuration:
        | property | value |
        | format   | LOG.%(levelname)-8s %(name)s %(message)s |
        | datefmt  |       |

IDEA:

.. code-block:: gherkin

    Given I capture log records
    When I create log records with:
        | category | level   | message |
        | foo.bar  | WARN    | Hello LogRecord |
    Then the captured log should contain the following log records:
        | category | level   | message |
        | bar      | CURRENT | xxx     |
    And the captured log should not contain the following log records:
        | category | level   | message |
        | bar      | CURRENT | xxx     |
 __future__ absolute_import behave given when then step behave4cmd0.command_steps step_file_should_contain_multiline_text step_file_should_not_contain_multiline_text behave.configuration LogLevel behave.log_capture LoggingCapture N/A logging make_log_record N/A N/A category level message N/A N/A N/A N/A category N/A root __ROOT__ N/A N/A category None N/A logger N/A N/A logging getLogger category N/A N/A N/A logger log level message N/A make_log_record_output N/A N/A category level message format datefmt N/A None None kwargs N/A N/A 
    Create the output for a log record, like performed by :mod:`logging` module.

    :param category:    Name of the logger (as string or None).
    :param level:       Log level (as number).
    :param message:     Log message to use.
    :returns: Log record output (as string)
     N/A N/A N/A category N/A category __ROOT__ N/A N/A category root N/A levelname N/A N/A logging getLevelName level N/A record_data N/A dict name category levelname levelname msg message N/A N/A N/A record_data update kwargs N/A record N/A N/A logging makeLogRecord record_data N/A formatter N/A N/A logging Formatter format datefmt datefmt N/A N/A N/A formatter format record N/A LogRecordTable N/A object N/A make_output_for_row N/A N/A cls row format datefmt N/A None None kwargs N/A N/A category N/A N/A row get category None N/A level N/A N/A LogLevel parse_type N/A N/A row get level INFO N/A message N/A N/A row get message __UNDEFINED__ N/A N/A make_log_record_output category level message format datefmt kwargs N/A classmethod annotate_with_row_schema N/A N/A table row_schema N/A N/A N/A 
        Annotate/extend a table of log-records with additional columns from
        the log-record schema if columns are missing.

        :param table:   Table w/ log-records (as :class:`behave.model.Table`)
        :param row_schema:  Log-record row schema (as dict).
         N/A N/A column value N/A N/A row_schema items N/A N/A N/A column N/A table headings N/A N/A N/A N/A table add_column column default_value value N/A staticmethod N/A step_I_create_logrecords_with_table N/A N/A context N/A N/A N/A 
    Step definition that creates one more log records by using a table.

    .. code-block: gherkin

        When I create log records with:
            | category | level | message   |
            |  foo     | ERROR | Hello Foo |
            |  foo.bar | WARN  | Hello Foo.Bar |

    Table description
    ------------------

    | Column   | Type     | Required | Description |
    | category | string   | yes      | Category (or logger) to use. |
    | level    | LogLevel | yes      | Log level to use.   |
    | message  | string   | yes      | Log message to use. |

    .. code-block: python

        import logging
        from behave.configuration import LogLevel
        for row in table.rows:
            logger = logging.getLogger(row.category)
            level  = LogLevel.parse_type(row.level)
            logger.log(level, row.message)
     N/A N/A context table REQUIRE: context.table N/A N/A N/A N/A context table require_columns N/A category level message N/A row N/A N/A context table rows N/A N/A category N/A row N/A category N/A N/A category __ROOT__ N/A N/A category None N/A level N/A N/A LogLevel parse_type N/A row N/A level N/A message N/A row N/A message N/A N/A make_log_record category level message N/A N/A step I create log records with step_I_create_logrecord_with_table N/A N/A context N/A N/A N/A 
    Create an log record by using a table to provide the parts.

    .. seealso: :func:`step_I_create_logrecords_with_table()`
     N/A N/A context table REQUIRE: context.table N/A N/A N/A len N/A N/A context table rows 1 REQUIRE: table.row.size == 1 N/A N/A step_I_create_logrecords_with_table context N/A N/A step I create a log record with step_I_define_logrecord_schema_with_table N/A N/A context N/A N/A N/A N/A context table REQUIRE: context.table N/A N/A N/A N/A context table require_columns N/A category level message N/A N/A N/A len N/A N/A context table rows 1 N/A REQUIRE: context.table.rows.size(%s) == 1 N/A len N/A N/A context table rows N/A row N/A N/A N/A context table rows N/A 0 N/A row_schema N/A dict category N/A row N/A category level N/A row N/A level message N/A row N/A message N/A N/A context log_record_row_schema row_schema N/A N/A step I define the log record schema step_command_output_should_contain_log_records N/A N/A context N/A N/A N/A 
    Verifies that the command output contains the specified log records
    (in any order).

    .. code-block: gherkin

        Then the command output should contain the following log records:
            | category | level   | message |
            | bar      | CURRENT | xxx     |
     N/A N/A context table REQUIRE: context.table N/A N/A N/A N/A context table require_columns N/A category level message N/A format N/A getattr context log_record_format N/A N/A context config logging_format N/A row N/A N/A context table rows N/A N/A output N/A N/A LogRecordTable make_output_for_row row format N/A N/A N/A context execute_steps N/A N/A 
            Then the command output should contain:
                """
                {expected_output}
                """
             format expected_output output N/A N/A then the command output should contain the following log records step_command_output_should_not_contain_log_records N/A N/A context N/A N/A N/A 
    Verifies that the command output contains the specified log records
    (in any order).

    .. code-block: gherkin

        Then the command output should contain the following log records:
            | category | level   | message |
            | bar      | CURRENT | xxx     |
     N/A N/A context table REQUIRE: context.table N/A N/A N/A N/A context table require_columns N/A category level message N/A format N/A getattr context log_record_format N/A N/A context config logging_format N/A row N/A N/A context table rows N/A N/A output N/A N/A LogRecordTable make_output_for_row row format N/A N/A N/A context execute_steps N/A N/A 
            Then the command output should not contain:
                """
                {expected_output}
                """
             format expected_output output N/A N/A then the command output should not contain the following log records step_command_output_should_contain_log_record N/A N/A context N/A N/A N/A N/A context table REQUIRE: context.table N/A N/A N/A len N/A N/A context table rows 1 REQUIRE: table.row.size == 1 N/A N/A step_command_output_should_contain_log_records context N/A N/A then the command output should contain the following log record step_command_output_should_not_contain_log_record N/A N/A context N/A N/A N/A N/A context table REQUIRE: context.table N/A N/A N/A len N/A N/A context table rows 1 REQUIRE: table.row.size == 1 N/A N/A step_command_output_should_not_contain_log_records context N/A N/A then the command output should not contain the following log record step_command_output_should_contain_log_records_from_categories N/A N/A context N/A N/A N/A 
    Verifies that the command output contains the specified log records
    (in any order).

    .. code-block: gherkin

        Given I define a log record schema:
            | category | level | message |
            | root     | ERROR | __LOG_MESSAGE__ |
        Then the command output should contain log records from categories:
            | category |
            | bar      |
     N/A N/A context table REQUIRE: context.table N/A N/A N/A N/A context table require_column category N/A record_schema N/A context log_record_row_schema N/A N/A N/A LogRecordTable annotate_with_row_schema N/A context table record_schema N/A N/A step_command_output_should_contain_log_records context N/A N/A N/A N/A context table remove_columns N/A level message N/A N/A then the command output should contain log records from categories step_command_output_should_not_contain_log_records_from_categories N/A N/A context N/A N/A N/A 
    Verifies that the command output contains not log records from
    the provided log categories (in any order).

    .. code-block: gherkin

        Given I define the log record schema:
            | category | level | message |
            | root     | ERROR | __LOG_MESSAGE__ |
        Then the command output should not contain log records from categories:
            | category |
            | bar      |
     N/A N/A context table REQUIRE: context.table N/A N/A N/A N/A context table require_column category N/A record_schema N/A context log_record_row_schema N/A N/A N/A LogRecordTable annotate_with_row_schema N/A context table record_schema N/A N/A step_command_output_should_not_contain_log_records context N/A N/A N/A N/A context table remove_columns N/A level message N/A N/A then the command output should not contain log records from categories step_file_should_contain_log_records N/A N/A context filename N/A N/A N/A 
    Verifies that the command output contains the specified log records
    (in any order).

    .. code-block: gherkin

        Then the file "xxx.log" should contain the log records:
            | category | level   | message |
            | bar      | CURRENT | xxx     |
     N/A N/A context table REQUIRE: context.table N/A N/A N/A N/A context table require_columns N/A category level message N/A format N/A getattr context log_record_format N/A N/A context config logging_format N/A row N/A N/A context table rows N/A N/A output N/A N/A LogRecordTable make_output_for_row row format N/A N/A context text output N/A N/A step_file_should_contain_multiline_text context filename N/A N/A then the file "{filename}" should contain the log records step_file_should_not_contain_log_records N/A N/A context filename N/A N/A N/A 
    Verifies that the command output contains the specified log records
    (in any order).

    .. code-block: gherkin

        Then the file "xxx.log" should not contain the log records:
            | category | level   | message |
            | bar      | CURRENT | xxx     |
     N/A N/A context table REQUIRE: context.table N/A N/A N/A N/A context table require_columns N/A category level message N/A format N/A getattr context log_record_format N/A N/A context config logging_format N/A row N/A N/A context table rows N/A N/A output N/A N/A LogRecordTable make_output_for_row row format N/A N/A context text output N/A N/A step_file_should_not_contain_multiline_text context filename N/A N/A then the file "{filename}" should not contain the log records step_use_log_record_format_text N/A N/A context log_record_format N/A N/A N/A N/A context log_record_format log_record_format N/A N/A step I use "{log_record_format}" as log record format step_use_log_record_configuration N/A N/A context N/A N/A N/A 
    Define log record configuration parameters.

    .. code-block: gherkin

        Given I use the log record configuration:
            | property | value |
            | format   |       |
            | datefmt  |       |
     N/A N/A context table REQUIRE: context.table N/A N/A N/A N/A context table require_columns N/A property value N/A row N/A N/A context table rows N/A N/A property_name N/A row N/A property N/A value N/A row N/A value N/A N/A property_name format N/A N/A N/A context log_record_format value N/A N/A N/A property_name datefmt N/A N/A N/A context log_record_datefmt value N/A N/A N/A KeyError N/A Unknown property=%s property_name N/A N/A step I use the log record configuration step_I_capture_logrecords N/A N/A context level N/A N/A N/A N/A NotImplementedError N/A N/A step I capture log records with level "{level}" or above step_I_capture_logrecords N/A N/A context N/A N/A N/A 

    .. code-block: gherkin
        Given I capture log records
        When I capture log records

    :param context:
     N/A N/A NotImplementedError N/A logcapture N/A getattr context logcapture None N/A N/A logcapture N/A N/A N/A context logcapture N/A LoggingCapture N/A N/A step I capture log records