Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Payloads should have better indentation in logging output #670

Closed
111pontes opened this issue Jan 22, 2018 · 0 comments
Closed

Payloads should have better indentation in logging output #670

111pontes opened this issue Jan 22, 2018 · 0 comments

Comments

@111pontes
Copy link
Collaborator

XML/JSON payload should be properly indented in logging output to improve human usability of the logs. In 0.6.3, payload output looks like this:

2018-01-22 14:45:05,085 - ydk - INFO - =============Generating payload to send to device=============
2018-01-22 14:45:05,086 - ydk - INFO - <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><edit-config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <target>
    <candidate/>
  </target>
  <error-option>rollback-on-error</error-option>
  <config><mpls-ldp xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-mpls-ldp-cfg" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="merge">
  <enable/>
  <default-vrf>
    <interfaces>
      <interface>
        <interface-name>GigabitEthernet0/0/0/0</interface-name>
        <enable/>
      </interface>
      <interface>
        <interface-name>GigabitEthernet0/0/0/1</interface-name>
        <enable/>
      </interface>
    </interfaces>
  </default-vrf>
</mpls-ldp>
</config>
</edit-config>
</rpc>
2018-01-22 14:45:05,086 - ydk - INFO -

2018-01-22 14:45:05,302 - ydk - INFO - =============Reply payload received from device=============
2018-01-22 14:45:05,303 - ydk - INFO - <?xml version="1.0"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <ok/>
</rpc-reply>

2018-01-22 14:45:05,303 - ydk - INFO -

2018-01-22 14:45:05,303 - ydk - INFO - Executing commit RPC: <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><commit/></rpc>
2018-01-22 14:45:05,886 - ydk - INFO - =============Reply payload received from device=============
2018-01-22 14:45:05,890 - ydk - INFO - <?xml version="1.0"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2">
  <ok/>
</rpc-reply>

2018-01-22 14:45:05,890 - ydk - INFO -

2018-01-22 14:45:05,890 - ydk - INFO - Operation succeeded
2018-01-22 14:45:05,890 - ydk - INFO - Disconnected from device

With proper indentation and separation, it should look like this:

2018-01-22 14:45:05,085 - ydk - INFO - =============Generating payload to send to device=============
2018-01-22 14:45:05,086 - ydk - INFO - 
<?xml version="1.0"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <edit-config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <target>
      <candidate/>
    </target>
    <error-option>rollback-on-error</error-option>
    <config>
      <mpls-ldp xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-mpls-ldp-cfg" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="merge">
        <enable/>
        <default-vrf>
          <interfaces>
            <interface>
              <interface-name>GigabitEthernet0/0/0/0</interface-name>
              <enable/>
            </interface>
            <interface>
              <interface-name>GigabitEthernet0/0/0/1</interface-name>
              <enable/>
            </interface>
          </interfaces>
        </default-vrf>
      </mpls-ldp>
    </config>
  </edit-config>
</rpc>
2018-01-22 14:45:05,086 - ydk - INFO -

2018-01-22 14:45:05,302 - ydk - INFO - =============Reply payload received from device=============
2018-01-22 14:45:05,303 - ydk - INFO - 
<?xml version="1.0"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <ok/>
</rpc-reply>

2018-01-22 14:45:05,303 - ydk - INFO -

2018-01-22 14:45:05,303 - ydk - INFO - Executing commit RPC: 
<?xml version="1.0"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <commit/>
</rpc>

2018-01-22 14:45:05,886 - ydk - INFO - =============Reply payload received from device=============
2018-01-22 14:45:05,890 - ydk - INFO - 
<?xml version="1.0"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2">
  <ok/>
</rpc-reply>

2018-01-22 14:45:05,890 - ydk - INFO -

2018-01-22 14:45:05,890 - ydk - INFO - Operation succeeded
2018-01-22 14:45:05,890 - ydk - INFO - Disconnected from device
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant