]> mj.ucw.cz Git - libucw.git/log
libucw.git
14 years agoAdded functions for conversions from string to uns or uintmax_t .
Daniel Fiala [Tue, 11 May 2010 02:38:49 +0000 (04:38 +0200)]
Added functions for conversions from string to uns or uintmax_t .

14 years agolibucw: Implemented Loging.Stream.FileDesc.
Pavel Charvat [Thu, 18 Feb 2010 15:12:15 +0000 (16:12 +0100)]
libucw: Implemented Loging.Stream.FileDesc.

14 years agoUCW::CGI -- fixed a bug in parsing of boundaries
Martin Mares [Mon, 23 Nov 2009 19:40:49 +0000 (20:40 +0100)]
UCW::CGI -- fixed a bug in parsing of boundaries

Interpolating user-supplied strings inside regular expressions in unsafe, even
if /\Q...\E/ were used.

In this case, it fails when Webkit-based browsers send boundary strings
containing "+" characters.

15 years agoOprava URL v authors
Michal Vaner [Thu, 15 Oct 2009 08:52:51 +0000 (10:52 +0200)]
Oprava URL v authors

15 years agoFixed bugs in sorter docs.
Martin Mares [Wed, 16 Sep 2009 12:05:18 +0000 (14:05 +0200)]
Fixed bugs in sorter docs.

15 years agoImproved building of centrum-sherlock-* packages.
Pavel Charvat [Sat, 4 Jul 2009 14:27:00 +0000 (16:27 +0200)]
Improved building of centrum-sherlock-* packages.

* Added sherlock build system to centrum-sherlock-lib-dev.
* We now use custom INSTALL_*_DIR options to avoid replacing of paths everywhere.
* Resulting .tar.gz contains entire sherlock tree.

15 years agoAdded MAX_WORD_BYTES and MAX_WORD_CHARS to ucw/autoconf.h .
Daniel Fiala [Tue, 2 Jun 2009 11:26:05 +0000 (13:26 +0200)]
Added MAX_WORD_BYTES and MAX_WORD_CHARS to ucw/autoconf.h .

15 years agoMade ucw/unaligned.h compatible with the worst programming language :-)
Daniel Fiala [Mon, 1 Jun 2009 11:50:31 +0000 (13:50 +0200)]
Made ucw/unaligned.h compatible with the worst programming language :-)
ucw/log.h added between exported headers.

15 years agoIncreased the version number of the developement branch.
Pavel Charvat [Mon, 25 May 2009 09:33:12 +0000 (11:33 +0200)]
Increased the version number of the developement branch.

15 years agoDefined the position independent version of libcharset.
Pavel Charvat [Wed, 6 May 2009 17:29:06 +0000 (19:29 +0200)]
Defined the position independent version of libcharset.

15 years agoJust fixed a comment in libimages.
Pavel Charvat [Wed, 29 Apr 2009 15:38:55 +0000 (17:38 +0200)]
Just fixed a comment in libimages.

15 years agoDo not leave any colorspace conversions to libjpeg and make them manually.
Pavel Charvat [Wed, 29 Apr 2009 14:20:46 +0000 (16:20 +0200)]
Do not leave any colorspace conversions to libjpeg and make them manually.

15 years agoStore thumbnails in the YCbCr colorspace.
Pavel Charvat [Wed, 29 Apr 2009 14:14:01 +0000 (16:14 +0200)]
Store thumbnails in the YCbCr colorspace.

15 years agoO_CLOEXEC is not always available on Linux, too
Martin Mares [Mon, 13 Apr 2009 12:31:59 +0000 (14:31 +0200)]
O_CLOEXEC is not always available on Linux, too

15 years agomove strnlen() to ucw/string.c
Robert Spalek [Sat, 11 Apr 2009 21:26:50 +0000 (14:26 -0700)]
move strnlen() to ucw/string.c

15 years agoadd strnlen() which isn't available on Darwin
Robert Spalek [Sat, 11 Apr 2009 20:12:42 +0000 (13:12 -0700)]
add strnlen() which isn't available on Darwin

now all tests pass

15 years agomake mainloop.c work on Darwin, where O_CLOEXEC is not available
Robert Spalek [Sat, 11 Apr 2009 19:43:06 +0000 (12:43 -0700)]
make mainloop.c work on Darwin, where O_CLOEXEC is not available

I just if'ed out the new code.

15 years agoversion number changed to 4.0
Robert Spalek [Tue, 7 Apr 2009 02:38:55 +0000 (19:38 -0700)]
version number changed to 4.0

15 years agoMerge branch 'dev-lib'
Robert Spalek [Tue, 7 Apr 2009 02:32:59 +0000 (19:32 -0700)]
Merge branch 'dev-lib'

15 years agoLibucw: Fixed a bug in logging of 8-bit characters.
Martin Mares [Tue, 24 Mar 2009 22:07:54 +0000 (23:07 +0100)]
Libucw: Fixed a bug in logging of 8-bit characters.

15 years agoMake selfpipe read/write errors nonfatal
Michal Vaner [Mon, 9 Mar 2009 17:58:01 +0000 (18:58 +0100)]
Make selfpipe read/write errors nonfatal

die in signal handler is unsafe and the errors should not cause anything
really bad anyway.

15 years agoFix the selfpipe in mainloop
Michal Vaner [Sun, 8 Mar 2009 10:34:28 +0000 (11:34 +0100)]
Fix the selfpipe in mainloop

Removed dependency on pipe2 (may be unavailable too), various fixes.

15 years agoSolved mainloop race by selfpipe
Michal Vaner [Sat, 7 Mar 2009 21:40:10 +0000 (22:40 +0100)]
Solved mainloop race by selfpipe

A better solution would be using ppoll, but it is not generally
available. It will be detected and used if available soon.

15 years agoConfigure: Check for pkg-config before using it.
Martin Mares [Sat, 7 Mar 2009 13:24:34 +0000 (14:24 +0100)]
Configure: Check for pkg-config before using it.

15 years agoConfig: Fixed an error message text.
Martin Mares [Wed, 4 Mar 2009 11:33:49 +0000 (12:33 +0100)]
Config: Fixed an error message text.

The "include" command is no longer called "input".

15 years agoConfig: When cf_getopt() reports an error, do not commit config.
Martin Mares [Wed, 4 Mar 2009 11:32:32 +0000 (12:32 +0100)]
Config: When cf_getopt() reports an error, do not commit config.

In such situations, the configuration sections need not be initialized
properly.

15 years agoUpdated years in all README's.
Martin Mares [Sun, 22 Feb 2009 17:36:24 +0000 (18:36 +0100)]
Updated years in all README's.

15 years agoForgot to update SHERLOCK_VERSION.
Martin Mares [Sun, 22 Feb 2009 17:34:40 +0000 (18:34 +0100)]
Forgot to update SHERLOCK_VERSION.

15 years agoConfig: If cf_def_file is NULL, initialize the configuration.
Martin Mares [Sun, 22 Feb 2009 10:41:13 +0000 (11:41 +0100)]
Config: If cf_def_file is NULL, initialize the configuration.

Otherwise we end up uninitialized clists and other nasty stuff. (The problems
were rarely visible, but the recent changes to conf-input.c have caused some
extra commits, which crashed when no configuration was loaded.)

This is a departure from the behavior of LibUCW 3.12, but I think we should
guarantee that after cf_getopt(), the configuration is always in a consistent
state, meaning that it has been initialized and committed. This should not
depend on whether the default config file was loaded or not.

On the other hand, program which avoid cf_getopt() and call cf_load() are on
their own, there is no implicit commit for them yet. Maybe this should be
fixed, too.

15 years agoLogging: Following streams by stderr is now configurable.
Martin Mares [Sat, 21 Feb 2009 21:22:49 +0000 (22:22 +0100)]
Logging: Following streams by stderr is now configurable.

15 years agoLogging: A minor optimization of log_apply_limits().
Martin Mares [Sat, 21 Feb 2009 21:08:40 +0000 (22:08 +0100)]
Logging: A minor optimization of log_apply_limits().

Exit early if all types in the set are unknown.

15 years agoLogging: Let log_new_file() and log_new_fd() accept flags.
Martin Mares [Sat, 21 Feb 2009 21:05:29 +0000 (22:05 +0100)]
Logging: Let log_new_file() and log_new_fd() accept flags.

This way, we can request a stream cloned to stderr (originally, this was
available only via log_file()) or a FD-based stream which closes the FD
upon closing.

15 years agoLogging: Save the config file we use for testing of log-conf.c.
Martin Mares [Sat, 21 Feb 2009 20:20:00 +0000 (21:20 +0100)]
Logging: Save the config file we use for testing of log-conf.c.

15 years agoLogging: Document the configuration file.
Martin Mares [Sat, 21 Feb 2009 20:18:27 +0000 (21:18 +0100)]
Logging: Document the configuration file.

15 years agoLogging: Documented the rate limiters.
Martin Mares [Sat, 21 Feb 2009 19:54:03 +0000 (20:54 +0100)]
Logging: Documented the rate limiters.

15 years agoLogging: Write a note when some messages fall victim to limiting.
Martin Mares [Sat, 21 Feb 2009 19:31:30 +0000 (20:31 +0100)]
Logging: Write a note when some messages fall victim to limiting.

I was considering various shapes of this message. It is tempting to mention
the number of dropped messages, but that has to be done at the time of
an accepted message, which could be too late (the user might already have
wondered about the fate of the missing messages).

Second, I wanted to include a message type, but it would be misleading,
since a single limiter can apply to more types at once with a common bucket.

15 years agoLogging: Let TBF report the number of dropped messages.
Martin Mares [Sat, 21 Feb 2009 19:29:10 +0000 (20:29 +0100)]
Logging: Let TBF report the number of dropped messages.

15 years agoLogging: Add a couple of comments.
Martin Mares [Sat, 21 Feb 2009 19:14:42 +0000 (20:14 +0100)]
Logging: Add a couple of comments.

15 years agoLogging: Added configurable limits.
Martin Mares [Fri, 20 Feb 2009 17:09:26 +0000 (18:09 +0100)]
Logging: Added configurable limits.

Not tested yet.

15 years agoLogging: Introduce LS_NUM_TYPES and use it.
Martin Mares [Fri, 20 Feb 2009 17:09:12 +0000 (18:09 +0100)]
Logging: Introduce LS_NUM_TYPES and use it.

15 years agoLogging: Let log_msg contain the current time as a timeval, too.
Martin Mares [Fri, 20 Feb 2009 17:08:46 +0000 (18:08 +0100)]
Logging: Let log_msg contain the current time as a timeval, too.

15 years agoLogging: Implemented rate limiting based on the Token Bucket Filter.
Martin Mares [Fri, 20 Feb 2009 16:41:47 +0000 (17:41 +0100)]
Logging: Implemented rate limiting based on the Token Bucket Filter.

So far, it is a simple FP implementation. Maybe I will switch to integers later.

15 years agoLogging: L_SIGHANDLER should be really safe.
Martin Mares [Fri, 20 Feb 2009 15:54:09 +0000 (16:54 +0100)]
Logging: L_SIGHANDLER should be really safe.

I have realized that many operations performed by the log stream code are
either unsafe to call from signal handlers, subject to races between the
main program and its signal handlers, or subject to deadlocks when the
ucwlib_lock is taken.

I have therefore changed the semantics of L_SIGHANDLER to provide only
the minimal logging service: All sighandler messages are now logged to
stderr (which usually follows the main log file) and they are limited
to 255 characters (so that no dynamic allocation is performed).

15 years agoLogging: Type-based filters and logging of type names are configurable.
Martin Mares [Thu, 19 Feb 2009 18:56:06 +0000 (19:56 +0100)]
Logging: Type-based filters and logging of type names are configurable.

15 years agoLogging: Fixed a bug in formatting of types.
Martin Mares [Thu, 19 Feb 2009 18:55:37 +0000 (19:55 +0100)]
Logging: Fixed a bug in formatting of types.

15 years agoLogging: Implemented message types.
Martin Mares [Thu, 19 Feb 2009 18:35:04 +0000 (19:35 +0100)]
Logging: Implemented message types.

15 years agoLogging: Fatality of logging errors is configurable.
Martin Mares [Thu, 19 Feb 2009 17:55:08 +0000 (18:55 +0100)]
Logging: Fatality of logging errors is configurable.

15 years agoLogging: The list of level names is consistent again.
Martin Mares [Thu, 19 Feb 2009 17:52:28 +0000 (18:52 +0100)]
Logging: The list of level names is consistent again.

I have moved the list to <ucw/lib.h>. It is needed only rarely, but at this
place we hopefully won't miss again it when changing the levels.

15 years agoLogging: Fixed formatting when we have neither log_title nor log_pid.
Martin Mares [Thu, 19 Feb 2009 17:51:38 +0000 (18:51 +0100)]
Logging: Fixed formatting when we have neither log_title nor log_pid.

15 years agoLogging: Report logging errors.
Martin Mares [Thu, 19 Feb 2009 17:48:23 +0000 (18:48 +0100)]
Logging: Report logging errors.

Introduce an analogue of the infamous "Error while printing error message" :-)

When logging to a stream fails, the error is reported to the default stream,
but there are two precautions against infinite loops and floods of error
messages. First, we never report an error when logging of an error fails.
Second, we report only the first failure of a stream.

It is also possible to request program termination when logging fails.

15 years agoLogging: Fixed a bug in log_close_all().
Martin Mares [Thu, 19 Feb 2009 17:03:14 +0000 (18:03 +0100)]
Logging: Fixed a bug in log_close_all().

Under some circumstances (involving loops in substream structure),
log_close_all() crashed, because a stream could have become freed
when removing its substreams.

I have changed log_close_all() to unlink all substreams first and
then proceed with deallocating memory.

The same problem can never occur in simple log_close_stream(),
because a stream that is a part of a loop never gets a use count of 0.

15 years agoLogging: Let log handlers return errno upon error.
Martin Mares [Thu, 19 Feb 2009 16:57:03 +0000 (17:57 +0100)]
Logging: Let log handlers return errno upon error.

15 years agoLogging: Adapted the `logger' utility to the new numbering of levels.
Martin Mares [Thu, 19 Feb 2009 16:27:18 +0000 (17:27 +0100)]
Logging: Adapted the `logger' utility to the new numbering of levels.

15 years agoLogging: Let the log level mask be configurable.
Martin Mares [Thu, 19 Feb 2009 16:22:44 +0000 (17:22 +0100)]
Logging: Let the log level mask be configurable.

15 years agoConfig parser: Document :reset.
Martin Mares [Thu, 19 Feb 2009 16:15:46 +0000 (17:15 +0100)]
Config parser: Document :reset.

15 years agoConfig parser: Added a new operation `:reset', which is a shorthand
Martin Mares [Thu, 19 Feb 2009 16:15:32 +0000 (17:15 +0100)]
Config parser: Added a new operation `:reset', which is a shorthand
for `:clear' and `:append'.

I am not too confident about the name ... does anybody have a better idea?

15 years agoConfig parser: Let `:append' and `:prepend' on bitmaps be equivalent to `:set'.
Martin Mares [Thu, 19 Feb 2009 15:51:57 +0000 (16:51 +0100)]
Config parser: Let `:append' and `:prepend' on bitmaps be equivalent to `:set'.

15 years agoLogging: Cleaned up documentation.
Martin Mares [Wed, 18 Feb 2009 16:58:52 +0000 (17:58 +0100)]
Logging: Cleaned up documentation.

15 years agoLogging: Let log_file() maintain proper use count of the stream.
Martin Mares [Mon, 16 Feb 2009 22:59:44 +0000 (23:59 +0100)]
Logging: Let log_file() maintain proper use count of the stream.

15 years agoLogging: Add log_configured() to set up the default log stream as configured.
Martin Mares [Mon, 16 Feb 2009 22:59:23 +0000 (23:59 +0100)]
Logging: Add log_configured() to set up the default log stream as configured.

15 years agoLogging: Precise timestamps and syslog PID flag are now configurable.
Martin Mares [Mon, 16 Feb 2009 22:55:44 +0000 (23:55 +0100)]
Logging: Precise timestamps and syslog PID flag are now configurable.

15 years agoLogging: Honor LSFMT_PID only when the PID is known.
Martin Mares [Mon, 16 Feb 2009 22:55:23 +0000 (23:55 +0100)]
Logging: Honor LSFMT_PID only when the PID is known.

15 years agoLogging: Let the default log format follow previous libucw defaults.
Martin Mares [Mon, 16 Feb 2009 22:55:07 +0000 (23:55 +0100)]
Logging: Let the default log format follow previous libucw defaults.

15 years agoLogging: Improved log-syslog.
Martin Mares [Mon, 16 Feb 2009 22:38:22 +0000 (23:38 +0100)]
Logging: Improved log-syslog.

It now accepts the name of the facility instead of the internal syslog code,
and also options for openlog(). Heavily commented on syslog deficiencies.

15 years agoLogging: Mention closing logfiles before exec in the docs.
Martin Mares [Mon, 16 Feb 2009 21:45:09 +0000 (22:45 +0100)]
Logging: Mention closing logfiles before exec in the docs.

15 years agoLogging: Let log_close_all() ASSERT that all references are gone.
Martin Mares [Sun, 15 Feb 2009 22:02:09 +0000 (23:02 +0100)]
Logging: Let log_close_all() ASSERT that all references are gone.

15 years agoLogging: A rough sketch of the logging configuration.
Martin Mares [Sun, 15 Feb 2009 21:59:49 +0000 (22:59 +0100)]
Logging: A rough sketch of the logging configuration.

15 years agoTypo in comment
Michal Vaner [Sun, 15 Feb 2009 12:15:44 +0000 (13:15 +0100)]
Typo in comment

15 years agoucw. docs: document single-line doc. comments
Michal Vaner [Sun, 15 Feb 2009 12:13:54 +0000 (13:13 +0100)]
ucw. docs: document single-line doc. comments

15 years agodoc. system: Allow single-line comments before def
Michal Vaner [Sun, 15 Feb 2009 12:10:00 +0000 (13:10 +0100)]
doc. system: Allow single-line comments before def

15 years agodoc. system: Escape hashes and underscores
Michal Vaner [Sun, 15 Feb 2009 11:02:44 +0000 (12:02 +0100)]
doc. system: Escape hashes and underscores

They were not properly escaped in symbol list, asciidoc did something
odd to them.

15 years agodoc. system: Do not backslash name...
Michal Vaner [Sun, 15 Feb 2009 10:55:32 +0000 (11:55 +0100)]
doc. system: Do not backslash name...

It puts the backslash there, not escapes the ellipsis.

15 years agodoc. system: detect function pointer variables
Michal Vaner [Sun, 15 Feb 2009 10:48:29 +0000 (11:48 +0100)]
doc. system: detect function pointer variables

15 years agoComment the magic extract functions
Michal Vaner [Sun, 15 Feb 2009 10:33:02 +0000 (11:33 +0100)]
Comment the magic extract functions

The regexps are hard to read, after some time. Comments what they do may
help parse them.

15 years agoLogging: Removed duplicate comments.
Martin Mares [Sat, 14 Feb 2009 23:33:58 +0000 (00:33 +0100)]
Logging: Removed duplicate comments.

A function should be documented at a single place, preferably in a header file.

Also removed a couple of comments at functions whose usage is perfectly
clear from their name.

15 years agoDocs: Fixed a typo introduced by the previous commit.
Martin Mares [Sat, 14 Feb 2009 23:21:55 +0000 (00:21 +0100)]
Docs: Fixed a typo introduced by the previous commit.

15 years agoMore documentation of <ucw/lib.h> and <ucw/config.h>.
Martin Mares [Sat, 14 Feb 2009 23:21:09 +0000 (00:21 +0100)]
More documentation of <ucw/lib.h> and <ucw/config.h>.

Still not complete.

15 years agoLogging: Fix log_close_all().
Martin Mares [Sat, 14 Feb 2009 22:25:33 +0000 (23:25 +0100)]
Logging: Fix log_close_all().

Closing of streams and freeing of memory has to be separate since we introduced
use counts.

15 years agoLogging: Documentation and minor cleanups of headers.
Martin Mares [Sat, 14 Feb 2009 21:21:58 +0000 (22:21 +0100)]
Logging: Documentation and minor cleanups of headers.

I have written complete documentation for the logging module. In the process,
I have performed a couple of minor cleanups:

   o  Internal declarations were moved to ucw/log-internal.h.
   o  Defines for "all" and "nothing" values have been removed, the customary
      constants `0' and `~0U' always work and they seem to be more readable.
   o  LSFLAG_SIGHANDLER gave its way to L_SIGHANDLER.
   o  The (unused) user flags field was replaced by a message type field;
      in the future, the streams will be able to filter the message based
      on a type.
   o  The `internal flags' field was renamed to `control bits'.

15 years agoLogging: The first bits of documentation.
Martin Mares [Sat, 14 Feb 2009 09:58:40 +0000 (10:58 +0100)]
Logging: The first bits of documentation.

I have also introduced a documentation chapter for <ucw/lib.h>, but only
logging functions are described so far.

log_switch() and friends have been moved to <ucw/log.h>, they are used rarely.

15 years agoLogging: Log file established log_file() is always dup'ed as stderr.
Martin Mares [Sat, 14 Feb 2009 09:23:19 +0000 (10:23 +0100)]
Logging: Log file established log_file() is always dup'ed as stderr.

Previously, stderr was set only at the first open and we forgot to re-dup
it after switching log files.

I have also removed the logic in do_log_reopen() which tried to keep the fd
of the log file stable. Except for having stderr follow the log file, this
was of no use.

15 years agoLogging: Added log_set_format() and log_default_stream().
Martin Mares [Sat, 14 Feb 2009 09:15:48 +0000 (10:15 +0100)]
Logging: Added log_set_format() and log_default_stream().

15 years agoLogging: Introduce inheritance of log_stream's.
Martin Mares [Fri, 13 Feb 2009 23:59:36 +0000 (00:59 +0100)]
Logging: Introduce inheritance of log_stream's.

The outbreak of various private fields (idata, pdata, udata) in struct log_stream
has gotten somewhat ugly, so I have replaced them by real private data allocated
after the standard portion of the log_stream structure.

log_new_stream() has gained a parameter telling it the size of the structure
to allocate. I have kept the recycler for the time being -- while saving allocations
is not worth the effort, it still nicely keeps the list of free stream ID's.

As idata are gone, the list of free items is now chained by log_stream->levels.

The default log stream no longer stores the fd explicitly, both log-file and
log-syslog keep private data in their own data structure extending log_stream.

15 years agoLogging: LOG_STREAM_DEFAULT is no longer needed.
Martin Mares [Fri, 13 Feb 2009 23:37:33 +0000 (00:37 +0100)]
Logging: LOG_STREAM_DEFAULT is no longer needed.

As we have un-constified log_stream_default, the casts are no longer
necessary, so I have removed the macro.

15 years agoLogging: Introduce use counts on streams.
Martin Mares [Fri, 13 Feb 2009 23:36:27 +0000 (00:36 +0100)]
Logging: Introduce use counts on streams.

It turned out to be quite inconvenient to have to close the substreams in
topological order. I have introduced use counts on all streams: A newly
created stream has use count of 1, whenever it is used as a substream,
the use count increases; when the count drops to 0, the stream is
automatically destroyed.

A slightly unpleasant side-effect is that the default log stream
can no longer be constant, since we modify its counter.

I have also extended log_rm_substream() to remove all substreams
when what==NULL. This is useful in log_close_stream() and also
in log_file().

15 years agoLogging: Improved documentation of struct log_stream.
Martin Mares [Fri, 13 Feb 2009 23:16:42 +0000 (00:16 +0100)]
Logging: Improved documentation of struct log_stream.

15 years agoLogging: Use LOG_STREAM_DEFAULT to refer to the default stream.
Martin Mares [Fri, 13 Feb 2009 23:08:17 +0000 (00:08 +0100)]
Logging: Use LOG_STREAM_DEFAULT to refer to the default stream.

This keeps the casts removing constness hidden.

15 years agoLogging: log_new_file() keeps its own copy of the path.
Martin Mares [Fri, 13 Feb 2009 23:04:07 +0000 (00:04 +0100)]
Logging: log_new_file() keeps its own copy of the path.

15 years agoLogging: Implemented log_switch().
Martin Mares [Fri, 13 Feb 2009 23:01:41 +0000 (00:01 +0100)]
Logging: Implemented log_switch().

15 years agoLogging: Introduced struct log_msg.
Martin Mares [Fri, 13 Feb 2009 18:47:00 +0000 (19:47 +0100)]
Logging: Introduced struct log_msg.

The logging handlers and filters are often interested in various properties
of the message in their raw form. I have modified the hooks to accept
a single pointer to `struct log_msg', which contains all needed information.

An immediate consequence is that we no longer need the calls to time() in
log-file, so a message is always timestamped at a single place when entering
the log machinery.

15 years agoLogging: Resurrected the log_file() interface.
Martin Mares [Fri, 13 Feb 2009 18:32:48 +0000 (19:32 +0100)]
Logging: Resurrected the log_file() interface.

It is still useful for programs that use just a single log file. It creates
a new file stream and connects it as a substream of stream #0, replacing
the previous substreams.

Also keep fd #2 as a duplicate of the log file fd, so that errors of exec'd
programs will not be lost.

15 years agoLogging: Rewritten the log-file module to implement log switching.
Martin Mares [Fri, 13 Feb 2009 18:20:47 +0000 (19:20 +0100)]
Logging: Rewritten the log-file module to implement log switching.

  o  log-file is a cross between the old libucw code and Tom's version.
  o  Introduced log_stream->udata for backend's flags.
  o  log_fork() moved to log.c.
  o  log_switch() and log_file() are not implemented yet.

15 years agoLogging: Cleanup of log-syslog.c.
Martin Mares [Fri, 13 Feb 2009 17:26:53 +0000 (18:26 +0100)]
Logging: Cleanup of log-syslog.c.

  o  Use a static array instead of switch() to translate log levels.
  o  Coding style and namespace cleanups.

15 years agoLogging: Fixed a silly bug in my cleanup of log_new_stream().
Martin Mares [Fri, 13 Feb 2009 17:25:56 +0000 (18:25 +0100)]
Logging: Fixed a silly bug in my cleanup of log_new_stream().

15 years agoLogging: Clean up log-stream.c.
Martin Mares [Fri, 13 Feb 2009 17:12:39 +0000 (18:12 +0100)]
Logging: Clean up log-stream.c.

  o  Simplified log_new_stream() -- recycling of closed streams
     and allocation of new streams are two different code paths now.
  o  The calls to log_init_module() need not be conditional.
  o  Use clist_init() for initializing clists.
  o  The usual coding style and namespace cleanups.

Also added an explanatory comment about the uninitialized state to log.c.

15 years agoLogging: Cleanup of log.c
Martin Mares [Fri, 13 Feb 2009 16:52:31 +0000 (17:52 +0100)]
Logging: Cleanup of log.c

   o  log_progname[] moved to log_init()
   o  Both vmsg() and log_pass_msg() now allocate the buffer on the stack
      if the message is smaller than 256 bytes.
   o  log_pid is used instead of repeated calls to getpid()
   o  sizeof(array) always preferred over repeated constants
   o  Many coding style cleanups to make the old and new code fit together.
   o  Namespace cleanups
   o  Updated comments

15 years agoLogging: Use `uns' instead of `u32' to pass flags.
Martin Mares [Fri, 13 Feb 2009 16:48:38 +0000 (17:48 +0100)]
Logging: Use `uns' instead of `u32' to pass flags.

15 years agoLogging: The Great Shuffle
Martin Mares [Fri, 13 Feb 2009 16:22:43 +0000 (17:22 +0100)]
Logging: The Great Shuffle

I have split the new logging machinery to several files and started merging
it with the old logger.

The intention behind the split is that programs which do not create their
own log streams should include only <ucw/lib.h> (which brings only the minimum
set of symbols) and link only a minimalistic library module, while the programs
in need of the full power of the new logger include <ucw/log.h> and link with
all log-* modules.

I have also started renaming `ls_*' to `log_*', but so far only at a couple
of places.

(Beware, most parts of the trees are currently left in an uncompilable
state. Use `make obj/ucw/log-t' for a working test program.)

15 years agoLogging: Coding style cleanups.
Martin Mares [Thu, 12 Feb 2009 23:07:30 +0000 (00:07 +0100)]
Logging: Coding style cleanups.

Also removed a couple of unused variables.

15 years agoLogging: Added a toy main() and plugged in the Makefile.
Martin Mares [Thu, 12 Feb 2009 22:57:49 +0000 (23:57 +0100)]
Logging: Added a toy main() and plugged in the Makefile.