2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.data.api.schema.stream;
10 import com.google.common.annotations.Beta;
11 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
12 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
13 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
19 * A {@link NormalizedNodeStreamWriter} which logs the events into a {@link Logger}.
22 public final class LoggingNormalizedNodeStreamWriter extends AbstractIndentingNormalizedNodeStreamWriter {
23 private static final Logger LOG = LoggerFactory.getLogger(LoggingNormalizedNodeStreamWriter.class);
25 public LoggingNormalizedNodeStreamWriter() {
26 // Default constructor
29 public LoggingNormalizedNodeStreamWriter(final int indentSize) {
35 LOG.trace("<<FLUSH>>");
40 LOG.debug("<<END-OF-STREAM>>");
44 void enterUnkeyedListItem(final NodeIdentifier name, final String indent) {
45 LOG.debug("{}{}[](no key)", indent, name);
49 void enterUnkeyedList(final NodeIdentifier name, final String indent) {
50 LOG.debug("{}{}(no key)", indent, name);
54 void enterMapNode(final NodeIdentifier name, final String indent) {
55 LOG.debug("{}{}(key)", indent, name);
59 void enterMapEntryNode(final NodeIdentifierWithPredicates identifier, final String indent) {
60 LOG.debug("{}{}[](key)", indent, identifier);
64 void enterLeafSet(final NodeIdentifier name, final String indent) {
65 LOG.debug("{}{}(leaf-list)", indent, name);
69 void enterContainerNode(final NodeIdentifier name, final String indent) {
70 LOG.debug("{}{}(container)", indent, name);
74 void enterChoiceNode(final NodeIdentifier name, final String indent) {
75 LOG.debug("{}{}(choice)", indent, name);
79 void enterLeafSetEntryNode(final NodeWithValue<?> name, final String indent) {
80 LOG.debug("{}{}(entry}", indent, name.getNodeType());
84 void enterLeafNode(final NodeIdentifier name, final String indent) {
85 LOG.debug("{}{}(leaf)", indent, name);
89 void enterAnyxmlNode(final NodeIdentifier name, final String indent) {
90 LOG.debug("{}{}(anyxml)", indent, name);
94 void enterAnydataNode(final NodeIdentifier name, final String indent) {
95 LOG.debug("{}{}(anydata)", indent, name);
99 void exitNode(final String indent) {
100 LOG.debug("{}(end)", indent);
104 @SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
105 void scalarValue(final Object value, final String indent) {
106 LOG.debug("{}({})={}", indent, value.getClass().getSimpleName(), value);