summaryrefslogtreecommitdiffstats
path: root/src/loggingrb.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2013-02-27 14:51:23 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2013-02-27 14:51:33 +0100
commitefd2bd691fd948df00c1eebcd8599b871f5c34f5 (patch)
tree30ee3f2f9890cbbef29a4af2108c4cc37818b407 /src/loggingrb.c
parent73377229bb33ab79682ce4b126a63602d13304ad (diff)
Revert "Added a ring buffer log target to store the last N log messages."
I noticed some more issues and it is the easiest to revert and include the fixed version. This reverts commit 73377229bb33ab79682ce4b126a63602d13304ad.
Diffstat (limited to 'src/loggingrb.c')
-rw-r--r--src/loggingrb.c98
1 files changed, 0 insertions, 98 deletions
diff --git a/src/loggingrb.c b/src/loggingrb.c
deleted file mode 100644
index 8faa5b11..00000000
--- a/src/loggingrb.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Ringbuffer-backed logging support code */
-
-/* (C) 2012-2013 by Katerina Barone-Adesi
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-
-/*! \addtogroup logging
- * @{
- */
-
-/*! \file loggingrb.c */
-
-#include <osmocom/core/strrb.h>
-#include <osmocom/core/logging.h>
-#include <osmocom/core/loggingrb.h>
-
-static void _rb_output(struct log_target *target,
- unsigned int level, const char *log)
-{
- osmo_strrb_add(target->tgt_rb.rb, log);
-}
-
-/*! \brief Return the number of log strings in the osmo_strrb-backed target.
- * \param[in] target The target to search.
- *
- * \return The number of log strings in the osmo_strrb-backed target.
- */
-size_t log_target_rb_used_size(struct log_target const *target)
-{
- return osmo_strrb_elements(target->tgt_rb.rb);
-}
-
-/*! \brief Return the capacity of the osmo_strrb-backed target.
- * \param[in] target The target to search.
- *
- * Note that this is the capacity (aka max number of messages).
- * It is not the number of unused message slots.
- * \return The number of log strings in the osmo_strrb-backed target.
- */
-size_t log_target_rb_avail_size(struct log_target const *target)
-{
- struct osmo_strrb *rb = target->tgt_rb.rb;
- return rb->size - 1;
-}
-
-/*! \brief Return the nth log entry in a target.
- * \param[in] target The target to search.
- * \param[in] logindex The index of the log entry/error message.
- *
- * \return A pointer to the nth message, or NULL if logindex is invalid.
- */
-const char *log_target_rb_get(struct log_target const *target, size_t logindex)
-{
- return osmo_strrb_get_nth(target->tgt_rb.rb, logindex);
-}
-
-/*! \brief Create a new logging target for ringbuffer-backed logging.
- * \param[in] size The size of the internal backing osmo_strrb (messages).
- * \returns A log target in case of success, NULL in case of error.
- */
-struct log_target *log_target_create_rb(size_t size)
-{
- struct log_target *target;
- struct osmo_strrb *rb;
-
- target = log_target_create();
- if (!target)
- return NULL;
-
- rb = osmo_strrb_create(target, size + 1);
- if (!rb) {
- log_target_destroy(target);
- return NULL;
- }
-
- target->tgt_rb.rb = rb;
- target->type = LOG_TGT_TYPE_STRRB;
- target->output = _rb_output;
-
- return target;
-}
-
-/* @} */