aboutsummaryrefslogtreecommitdiffstats
path: root/libparc/parc/logging/parc_LogReporterTextStdout.h
diff options
context:
space:
mode:
authorMichele Papalini <micpapal+fdio@cisco.com>2017-02-24 08:00:33 +0000
committerGerrit Code Review <gerrit@fd.io>2017-02-24 08:00:33 +0000
commit4df7f4cc98b6288177df256e1db70ddc3f7d00db (patch)
tree55e71277b419e4830ae641868ab8e751c8b86972 /libparc/parc/logging/parc_LogReporterTextStdout.h
parentf28308bd99381ef5f1e178e2e1f870f245e35873 (diff)
parentec688b4723a041044226358bcd4dd6e2da39da49 (diff)
Merge "Initial commit: cframework. Longbow and Libparc" into cframework/master
Diffstat (limited to 'libparc/parc/logging/parc_LogReporterTextStdout.h')
-rwxr-xr-xlibparc/parc/logging/parc_LogReporterTextStdout.h102
1 files changed, 102 insertions, 0 deletions
diff --git a/libparc/parc/logging/parc_LogReporterTextStdout.h b/libparc/parc/logging/parc_LogReporterTextStdout.h
new file mode 100755
index 00000000..4365330e
--- /dev/null
+++ b/libparc/parc/logging/parc_LogReporterTextStdout.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file parc_LogReporterTextStdout.h
+ * @brief A simple log reporter using plain text formatting to standard output.
+ *
+ */
+#ifndef PARC_Library_parc_LogReporterTextStdout_h
+#define PARC_Library_parc_LogReporterTextStdout_h
+
+#include <parc/logging/parc_LogReporter.h>
+
+/**
+ * Create a new instance of `PARCLogReporter` using standard output.
+ *
+ * @return NULL Memory could not be allocated.
+ * @return non-NULL A pointer to a valid `PARCLogReporter` instance.
+ *
+ * Example:
+ * @code
+ * {
+ * PARCLogReporter *reporter = parcLogReporterTextStdout_Create();
+ *
+ * parcLogReporter_Release(&reporter);
+ * }
+ * <#example#>
+ * @endcode
+ */
+PARCLogReporter *parcLogReporterTextStdout_Create(void);
+
+/**
+ * Increase the number of references to a `PARCLogReporter` instance.
+ *
+ * Note that new `PARCLogReporter` is not created,
+ * only that the given `PARCLogReporter` reference count is incremented.
+ * Discard the reference by invoking `parcLogEntry_Release`.
+ *
+ * @param [in] instance A pointer to a `PARCLogReporter` instance.
+ *
+ * @return The input `PARCLogReporter` pointer.
+ *
+ * Example:
+ * @code
+ * {
+ * PARCLogReporter *x = parcLogReporterTextStdout_Create();
+ *
+ * PARCLogReporter *x_2 = parcLogReporterTextStdout_Acquire(x);
+ *
+ * parcLogReporterTextStdout_Release(&x);
+ * parcLogReporterTextStdout_Release(&x_2);
+ * }
+ * @endcode
+ */
+PARCLogReporter *parcLogReporterTextStdout_Acquire(const PARCLogReporter *instance);
+
+/**
+ * Release a previously acquired reference to the specified instance,
+ * decrementing the reference count for the instance.
+ *
+ * The pointer to the instance is set to NULL as a side-effect of this function.
+ *
+ * If the invocation causes the last reference to the instance to be released,
+ * the instance is deallocated and the instance's implementation will perform
+ * additional cleanup and release other privately held references.
+ *
+ * @param [in,out] reporterP A pointer to a PARCLogReporter instance pointer, which will be set to zero on return.
+ *
+ * Example:
+ * @code
+ * {
+ * PARCLogReporter *x = parcLogReporterTextStdout_Create();
+ *
+ * parcLogReporterTextStdout_Release(&x);
+ * }
+ * @endcode
+ */
+void parcLogReporterTextStdout_Release(PARCLogReporter **reporterP);
+
+/**
+ * Report the given PARCLogEntry
+ *
+ * @param [in] reporter A pointer to a valid PARCLogReporter instance.
+ * @param [in] entry A pointer to a valid PARCLogEntry instance.
+ *
+ * @see parcLogReporter_Report
+ */
+void parcLogReporterTextStdout_Report(PARCLogReporter *reporter, const PARCLogEntry *entry);
+
+#endif