LogWriter impl

Implements logging of error messages to standard error channel.  See LogWriter.

Summary
LogWriter implImplements logging of error messages to standard error channel.
CopyrightThis program is free software.
Files
C-kern/api/io/writer/log/logwriter.hHeader file of LogWriter.
C-kern/io/writer/log/logwriter.cImplementation file LogWriter impl.
logwriter_chan_tExtends logbuffer_t with isappend mode and log_state_e.
lifetime
logwriter_chan_INITStatic initializer.
update
flush_logwriterchanFlushes logbuffer_t in chan.
logwriter_t
types
logwriter_it
static variables
s_logwriter_interfaceContains single instance of interface logwriter_it.
initthread
helper
allocatebuffer_logwriterReserves some memory pages for internal buffer.
freebuffer_logwriterFrees internal buffer.
lifetime
query
config
change
test

Copyright

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 2 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.

Author

© 2011 Jörg Seebohn

Files

C-kern/api/io/writer/log/logwriter.h

Header file of LogWriter.

C-kern/io/writer/log/logwriter.c

Implementation file LogWriter impl.

logwriter_chan_t

struct logwriter_chan_t

Extends logbuffer_t with isappend mode and log_state_e.  If isappend is true the next write to the buffer will be appended even if the buffer is full.

Summary

lifetime

logwriter_chan_INIT

#define logwriter_chan_INIT(
   size,
   addr,
   io,
   logstate
) { logbuffer_INIT(size, addr, io), 0, logstate, false }

Static initializer.

Parameter

sizeSize of a temporary or static buffer.
addrStart address of the buffer.
ioiochannel_t the buffer is written to.

update

flush_logwriterchan

static void flush_logwriterchan(logwriter_chan_t *chan)

Flushes logbuffer_t in chan.

logwriter_t

Summary
types
logwriter_it
static variables
s_logwriter_interfaceContains single instance of interface logwriter_it.
initthread
helper
allocatebuffer_logwriterReserves some memory pages for internal buffer.
freebuffer_logwriterFrees internal buffer.
lifetime
query
config
change
test

types

logwriter_it

log_it_DECLARE(logwriter_it,
logwriter_t)
Defines interface for <logwriter_t>see log_it_DECLARE.

static variables

s_logwriter_interface

static logwriter_it s_logwriter_interface

Contains single instance of interface logwriter_it.

initthread

helper

allocatebuffer_logwriter

static int allocatebuffer_logwriter(/*out*/memblock_t *buffer)

Reserves some memory pages for internal buffer.

freebuffer_logwriter

static int freebuffer_logwriter(memblock_t *buffer)

Frees internal buffer.

lifetime

query

config

change

test

Write error messages to STDERR for diagnostic purposes.
Implements logging of error messages to standard error channel.
struct logwriter_chan_t
Extends logbuffer_t with isappend mode and log_state_e.
Used to configure the state of a log_channel_e.
#define logwriter_chan_INIT(
   size,
   addr,
   io,
   logstate
) { logbuffer_INIT(size, addr, io), 0, logstate, false }
Static initializer.
static void flush_logwriterchan(logwriter_chan_t *chan)
Flushes logbuffer_t in chan.
log_it_DECLARE(logwriter_it,
logwriter_t)
static logwriter_it s_logwriter_interface
Contains single instance of interface logwriter_it.
static int allocatebuffer_logwriter(/*out*/memblock_t *buffer)
Reserves some memory pages for internal buffer.
static int freebuffer_logwriter(memblock_t *buffer)
Frees internal buffer.
typedef sys_iochannel_t iochannel_t
Describes an input/output channel like a file or network connection.
Implements log_it.log_it_DECLARE.
Close