aboutsummaryrefslogtreecommitdiffstats
path: root/src/log.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* log: don't call closelog() on !HAVE_SYSLOGMax Kellermann2009-01-031-0/+2
|
* log: removed unused logging wrappersMax Kellermann2008-12-291-4/+0
| | | | Removed GLib logging wrappers which are not used anymore.
* log: automatically append newlineMax Kellermann2008-12-291-4/+19
| | | | If a log message does not include a newline character, append it.
* Include <pthread.h> where it is necessary onlyThomas Jansen2008-12-281-1/+0
|
* log: use GLib loggingMax Kellermann2008-12-281-13/+13
|
* log: don't keep log file openMax Kellermann2008-12-281-14/+15
| | | | | | The log file is duped to STDOUT_FILENO and STDERR_FILENO. No need to keep another copy of it in out_fd all the time. We only need it once once in setup_log_output().
* log: support syslog()Max Kellermann2008-12-281-6/+103
| | | | Allow logging to syslog if log_file is configured to "syslog".
* log: moved code to log_init_file()Max Kellermann2008-12-281-15/+27
| | | | | Added log_init_file() and log_init_stdout(), preparing for other logging targets.
* log: merged initLog() and open_log_files().Max Kellermann2008-12-281-6/+1
| | | | | | The logging library currently has 3 constructor functions: initLog(), open_log_files(), setup_log_output(), called in this order. Merged the first two.
* log: moved code to parse_log_level()Max Kellermann2008-12-281-15/+17
|
* log: use the GLogLevelFlags typeMax Kellermann2008-12-281-3/+3
| | | | Declare log_threshold as GLogLevelFlags.
* log: don't manipulate the umaskMax Kellermann2008-12-281-9/+1
| | | | | | | | If the user wants the log files with a specific mode, he has to start MPD with the correct umask. Don't hard-code that. This fixes a bug: when log cycling failed, MPD would not restore the old umask.
* log: moved code to open_log_file()Max Kellermann2008-12-281-12/+19
| | | | Merged code from open_log_files() and cycle_log_files().
* log: deprecated "error_file" optionMax Kellermann2008-12-281-26/+2
| | | | | Removed the "error_file" option. There is only one log file now. If a user wants to see only the errors, he should configure a log_level.
* log: map log level "SECURE" to GLib's "INFO"Max Kellermann2008-12-201-3/+3
| | | | | | Make "secure" a log level different from "default". "secure" should be right between "default" and "verbose". Map "default" to Glib's "MESSAGE" log level.
* replaced mpd_printf etc by G_GNUC_PRINTFThomas Jansen2008-12-021-2/+2
| | | | | We want to remove gcc.h eventually. This takes care of all the G_GNUC_PRINTF macros.
* replaced mpd_noreturn by G_GNUC_NORETURNThomas Jansen2008-12-021-1/+1
| | | | | We want to remove gcc.h eventually. This takes care of all the G_GNUC_NORETURN macros.
* log: print the log_domainMax Kellermann2008-11-211-2/+6
|
* log: check the log threshold in log_func()Max Kellermann2008-11-141-0/+3
| | | | | The threshold was only checked in the deprecated logging functions (ERROR(), WARNING(), ...). Add the check to the GLib logging handler.
* log: properly check log_thresholdDaniel Schömer2008-11-091-1/+1
|
* log: check if log_charset is setMax Kellermann2008-11-051-5/+8
| | | | | When logging to a file, log_charset would be NULL and g_convert() would abort.
* log: convert messages to system charsetMax Kellermann2008-11-051-0/+14
| | | | | When logging to the terminal, we should print messages in the system character set. Convert all messages in this case.
* log: use boolMax Kellermann2008-11-051-5/+5
| | | | Use the bool data type for flags.
* log: provide a GLib logging handlerMax Kellermann2008-11-051-0/+15
| | | | | Install a default handler which writes to stdout or stderr, and prepends a time stamp. This looks just like the 0.13.x logger.
* log: use GLib message loggingMax Kellermann2008-11-051-20/+15
| | | | | | The logging functions from log.h are deprecated, and the code should use GLib logging instead. Make ERROR(), WARNING() etc. call g_logv() internally.
* log: no CamelCaseMax Kellermann2008-11-051-6/+8
| | | | Renamed the variable "logLevel" to "log_threshold".
* log: removed warning bufferMax Kellermann2008-11-051-76/+2
| | | | | The warning buffer is a complex piece of code for no good reason. Remove it and find a better solution, e.g. open the log file earlier.
* log: don't use utils.hMax Kellermann2008-10-291-5/+17
| | | | Prefer GLib over utils.h.
* don't include os_compat.hMax Kellermann2008-10-081-1/+7
| | | | | When there are standardized headers, use these instead of the bloated os_compat.h.
* include cleanupMax Kellermann2008-09-061-1/+0
| | | | As usual, include only headers which are really needed.
* log.c: thread-safety for warning logEric Wong2008-08-281-4/+12
| | | | | | I'm really no fan of the warning log, it's too complex for how little it gets used; but fixing it is another problem.
* fix sign compare warningsMax Kellermann2008-04-121-1/+1
| | | | | | | Do explicit casts before comparing signed with unsigned. The one in log.c actually fixes another warning: in the expanded macro, there may be a check "logLevel>=0", which is always true. git-svn-id: https://svn.musicpd.org/mpd/trunk@7230 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* zero is a valid file descriptorMax Kellermann2008-03-261-4/+4
| | | | | | | Although it may not happen in mpd code, it is perfectly possible for a newly allocated file descriptor to be zero. For theoretical correctness, allow 0. git-svn-id: https://svn.musicpd.org/mpd/trunk@7194 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Cleanup #includes of standard system headers and put them in one placeEric Wong2008-01-031-6/+1
| | | | | | | | | | | | | This will make refactoring features easier, especially now that pthreads support and larger refactorings are on the horizon. Hopefully, this will make porting to other platforms (even non-UNIX-like ones for masochists) easier, too. os_compat.h will house all the #includes for system headers considered to be the "core" of MPD. Headers for optional features will be left to individual source files. git-svn-id: https://svn.musicpd.org/mpd/trunk@7130 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Redirect stdin *before* we establish a listen socketEric Wong2007-09-051-29/+0
| | | | | | This way we'll avoid listening on fd=0 and have a better chance of having fd=0 as /dev/null git-svn-id: https://svn.musicpd.org/mpd/trunk@6852 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* log: oops, fix a syntax errorEric Wong2007-09-041-1/+1
| | | | | (yes, it helps to actually compile code before committing it) git-svn-id: https://svn.musicpd.org/mpd/trunk@6851 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* log: better bug avoidance for libraries incorrectly handling fd=0Eric Wong2007-09-041-2/+16
| | | | | | | | | | | | | We redirect stdin to /dev/null to work around a libao bug, but this bug has been fixed in libao since 2003 (according to jat). However, there are likely other bugs in other libraries (and even our code!) that handle fd=0 incorrectly and I'd rather not take the risk[1]. So So it's easiest to just keep fd=0==/dev/null for now... [1] - I've seen several of these myself... git-svn-id: https://svn.musicpd.org/mpd/trunk@6849 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fix endless loop when mpd is launched from a non-interactive shell.Eric Wong2007-09-021-1/+5
| | | | | | | | | | | | | | | | | | Thanks to _noth_ for the patch, this fixes Mantis bug #1534 _noth_ wrote: > When MPD is launched from a non-interactive shell, it enters an endless > loop, filling up its error log file with "error accept()'ing" messages. > This is caused by the fact that stdin is already closed when mpd starts > up. listenOnPort() opens up the first of its sockets as fd 0 (the first > empty fd table position). Then, setup_log_output()->redirect_stdin() > overwrites fd0 (fd=open("/dev/null",...); dup2(fd, STDIN_FILENO);) > without checking if it corresponds to the actual standard input (or if > it is open in the first place). This means that listenSockets[0].fd now > is a fd for /dev/null, thus doIOForInterfaces()->getConnections() can't > accept(2) on it and fails with the above error. The attached patch fixes > this for me. git-svn-id: https://svn.musicpd.org/mpd/trunk@6843 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* log: cleanup: avoid "magic" numbersEric Wong2007-08-281-6/+8
| | | | | | We used a bare '15' in several places and it's not immediately obvious where it came from. This makes it more obvious git-svn-id: https://svn.musicpd.org/mpd/trunk@6829 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* log: flush the warning log after redirecting stderr to the log filesJ. Alexander Treuman2007-06-291-0/+1
| | | | | | | | | | Previously, the warning log was only flushed if creating the db or logging to stdout. This meant that under normal circumstances (no db creation, logging to files) the warning log was never flushed. This caused a bug when a warning was printed for each call to the status command where the warning buffer would grow endlessly, eventually using more and more CPU to reallocate it. git-svn-id: https://svn.musicpd.org/mpd/trunk@6660 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* The massive copyright updateAvuton Olrich2007-04-051-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* More (v)snprintf-related buffer over-allocations removedEric Wong2007-02-191-1/+1
| | | | | Also took out an unnecessary memset in getPlayerErrorStr git-svn-id: https://svn.musicpd.org/mpd/trunk@5396 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Re-adding a fix to log.c that got pulled with the localization reversion.J. Alexander Treuman2007-02-181-5/+4
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5374 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Reverting all of my localization changes. It was a horribleJ. Alexander Treuman2007-02-181-19/+8
| | | | | | implementation, and fixing it is a big enough job that I don't know when I'll get around to it. Probably best just starting from scratch anyhow. git-svn-id: https://svn.musicpd.org/mpd/trunk@5373 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Don't initialize globals to zero (or NULL)Eric Wong2007-01-141-5/+5
| | | | | | | | Some compilers and linkers aren't smart enough to optimize this, as global variables are implictly initialized to zero. As a result, binaries are a bit smaller as more goes in the .bss and less in the text section. git-svn-id: https://svn.musicpd.org/mpd/trunk@5254 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Output warning messages in the current locale's charset.J. Alexander Treuman2007-01-081-1/+4
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5229 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fixed some silly logic that caused an extra \n to be printed when flushingJ. Alexander Treuman2007-01-081-5/+4
| | | | | warning messages. git-svn-id: https://svn.musicpd.org/mpd/trunk@5228 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Convert log messages sent to stdout to the current locale's charset.J. Alexander Treuman2007-01-081-2/+11
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5227 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* cleanup flushWarningBuffer() and make some for() loops in audio.c look and ↵Warren Dukes2006-10-031-10/+16
| | | | | do something sane. git-svn-id: https://svn.musicpd.org/mpd/trunk@4867 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* get rid of the pointless xopen wrapper, open(2) does not throw errno = EINTREric Wong2006-08-221-4/+4
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4663 09075e82-0dd4-0310-85a5-a0d7c8717e4f