1N/A/**
1N/A * logging.c - Centralised logging. Part of the Linux-NTFS project.
1N/A *
1N/A * Copyright (c) 2005 Richard Russon
1N/A *
1N/A * This program/include file is free software; you can redistribute it and/or
1N/A * modify it under the terms of the GNU General Public License as published
1N/A * by the Free Software Foundation; either version 2 of the License, or
1N/A * (at your option) any later version.
1N/A *
1N/A * This program/include file is distributed in the hope that it will be
1N/A * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
1N/A * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1N/A * GNU General Public License for more details.
1N/A *
1N/A * You should have received a copy of the GNU General Public License
1N/A * along with this program (in the main directory of the Linux-NTFS
1N/A * distribution in the file COPYING); if not, write to the Free Software
1N/A * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1N/A */
1N/A
1N/A#ifdef HAVE_CONFIG_H
1N/A#include "config.h"
1N/A#endif
1N/A
1N/A#ifdef HAVE_STDIO_H
1N/A#include <stdio.h>
1N/A#endif
1N/A#ifdef HAVE_ERRNO_H
1N/A#include <errno.h>
1N/A#endif
1N/A#ifdef HAVE_STDARG_H
1N/A#include <stdarg.h>
1N/A#endif
1N/A#ifdef HAVE_STRING_H
1N/A#include <string.h>
1N/A#endif
1N/A#ifdef HAVE_STDLIB_H
1N/A#include <stdlib.h>
1N/A#endif
1N/A#ifdef HAVE_SYSLOG_H
1N/A#include <syslog.h>
1N/A#endif
1N/A
1N/A#include "compat.h"
1N/A#include "logging.h"
1N/A
1N/A#ifndef PATH_SEP
1N/A#define PATH_SEP '/'
1N/A#endif
1N/A
1N/A/* Colour prefixes and a suffix */
1N/A#ifdef __sun
1N/Astatic const char *col_green = "\033[32m";
1N/Astatic const char *col_cyan = "\033[36m";
1N/Astatic const char *col_yellow = "\033[01;33m";
1N/Astatic const char *col_red = "\033[01;31m";
1N/Astatic const char *col_redinv = "\033[01;07;31m";
1N/Astatic const char *col_end = "\033[0m";
1N/A#else /* ! __sun */
1N/Astatic const char *col_green = "\e[32m";
1N/Astatic const char *col_cyan = "\e[36m";
1N/Astatic const char *col_yellow = "\e[01;33m";
1N/Astatic const char *col_red = "\e[01;31m";
1N/Astatic const char *col_redinv = "\e[01;07;31m";
1N/Astatic const char *col_end = "\e[0m";
1N/A#endif /* __sun */
1N/A
1N/A/**
1N/A * struct ntfs_logging - Control info for the logging system
1N/A * @levels: Bitfield of logging levels
1N/A * @flags: Flags which affect the output style
1N/A * @handler: Function to perform the actual logging
1N/A */
1N/Astruct ntfs_logging {
1N/A u32 levels;
1N/A u32 flags;
1N/A ntfs_log_handler *handler;
1N/A};
1N/A
1N/A/**
1N/A * ntfs_log - This struct controls all the logging in the library and tools.
1N/A */
1N/Astatic struct ntfs_logging ntfs_log = {
1N/A .levels = NTFS_LOG_LEVEL_INFO | NTFS_LOG_LEVEL_QUIET |
1N/A NTFS_LOG_LEVEL_WARNING | NTFS_LOG_LEVEL_ERROR |
1N/A NTFS_LOG_LEVEL_PERROR | NTFS_LOG_LEVEL_CRITICAL |
1N/A NTFS_LOG_LEVEL_PROGRESS |
1N/A 0,
1N/A .flags = NTFS_LOG_FLAG_ONLYNAME,
1N/A .handler = ntfs_log_handler_null,
1N/A};
1N/A
1N/A
1N/A/**
1N/A * ntfs_log_get_levels - Get a list of the current logging levels
1N/A *
1N/A * Find out which logging levels are enabled.
1N/A *
1N/A * Returns: Log levels in a 32-bit field
1N/A */
1N/Au32 ntfs_log_get_levels(void)
1N/A{
1N/A return ntfs_log.levels;
1N/A}
1N/A
1N/A/**
1N/A * ntfs_log_set_levels - Enable extra logging levels
1N/A * @levels: 32-bit field of log levels to set
1N/A *
1N/A * Enable one or more logging levels.
1N/A * The logging levels are named: NTFS_LOG_LEVEL_*.
1N/A *
1N/A * Returns: Log levels that were enabled before the call
1N/A */
1N/Au32 ntfs_log_set_levels(u32 levels)
1N/A{
1N/A u32 old;
1N/A old = ntfs_log.levels;
1N/A ntfs_log.levels |= levels;
1N/A return old;
1N/A}
1N/A
1N/A/**
1N/A * ntfs_log_clear_levels - Disable some logging levels
1N/A * @levels: 32-bit field of log levels to clear
1N/A *
1N/A * Disable one or more logging levels.
1N/A * The logging levels are named: NTFS_LOG_LEVEL_*.
1N/A *
1N/A * Returns: Log levels that were enabled before the call
1N/A */
1N/Au32 ntfs_log_clear_levels(u32 levels)
1N/A{
1N/A u32 old;
1N/A old = ntfs_log.levels;
1N/A ntfs_log.levels &= (~levels);
1N/A return old;
1N/A}
1N/A
1N/A
1N/A/**
1N/A * ntfs_log_get_flags - Get a list of logging style flags
1N/A *
1N/A * Find out which logging flags are enabled.
1N/A *
1N/A * Returns: Logging flags in a 32-bit field
1N/A */
1N/Au32 ntfs_log_get_flags(void)
1N/A{
1N/A return ntfs_log.flags;
1N/A}
1N/A
1N/A/**
1N/A * ntfs_log_set_flags - Enable extra logging style flags
1N/A * @flags: 32-bit field of logging flags to set
1N/A *
1N/A * Enable one or more logging flags.
1N/A * The log flags are named: NTFS_LOG_LEVEL_*.
1N/A *
1N/A * Returns: Logging flags that were enabled before the call
1N/A */
1N/Au32 ntfs_log_set_flags(u32 flags)
1N/A{
1N/A u32 old;
1N/A old = ntfs_log.flags;
1N/A ntfs_log.flags |= flags;
1N/A return old;
1N/A}
1N/A
1N/A/**
1N/A * ntfs_log_clear_flags - Disable some logging styles
1N/A * @flags: 32-bit field of logging flags to clear
1N/A *
1N/A * Disable one or more logging flags.
1N/A * The log flags are named: NTFS_LOG_LEVEL_*.
1N/A *
1N/A * Returns: Logging flags that were enabled before the call
1N/A */
1N/Au32 ntfs_log_clear_flags(u32 flags)
1N/A{
1N/A u32 old;
1N/A old = ntfs_log.flags;
1N/A ntfs_log.flags &= (~flags);
1N/A return old;
1N/A}
1N/A
1N/A
1N/A/**
1N/A * ntfs_log_get_stream - Default output streams for logging levels
1N/A * @level: Log level
1N/A *
1N/A * By default, urgent messages are sent to "stderr".
1N/A * Other messages are sent to "stdout".
1N/A *
1N/A * Returns: "string" Prefix to be used
1N/A */
1N/Astatic FILE * ntfs_log_get_stream(u32 level)
1N/A{
1N/A FILE *stream;
1N/A
1N/A switch (level) {
1N/A case NTFS_LOG_LEVEL_INFO:
1N/A case NTFS_LOG_LEVEL_QUIET:
1N/A case NTFS_LOG_LEVEL_PROGRESS:
1N/A case NTFS_LOG_LEVEL_VERBOSE:
1N/A stream = stdout;
1N/A break;
1N/A
1N/A case NTFS_LOG_LEVEL_DEBUG:
1N/A case NTFS_LOG_LEVEL_TRACE:
1N/A case NTFS_LOG_LEVEL_WARNING:
1N/A case NTFS_LOG_LEVEL_ERROR:
1N/A case NTFS_LOG_LEVEL_CRITICAL:
1N/A case NTFS_LOG_LEVEL_PERROR:
1N/A default:
1N/A stream = stderr;
1N/A break;
1N/A }
1N/A
1N/A return stream;
1N/A}
1N/A
1N/A/**
1N/A * ntfs_log_get_prefix - Default prefixes for logging levels
1N/A * @level: Log level to be prefixed
1N/A *
1N/A * Prefixing the logging output can make it easier to parse.
1N/A *
1N/A * Returns: "string" Prefix to be used
1N/A */
1N/Astatic const char * ntfs_log_get_prefix(u32 level)
1N/A{
1N/A const char *prefix;
1N/A
1N/A switch (level) {
1N/A case NTFS_LOG_LEVEL_DEBUG:
1N/A prefix = "DEBUG: ";
1N/A break;
1N/A case NTFS_LOG_LEVEL_TRACE:
1N/A prefix = "TRACE: ";
1N/A break;
1N/A case NTFS_LOG_LEVEL_QUIET:
1N/A prefix = "QUIET: ";
1N/A break;
1N/A case NTFS_LOG_LEVEL_INFO:
1N/A prefix = "INFO: ";
1N/A break;
1N/A case NTFS_LOG_LEVEL_VERBOSE:
1N/A prefix = "VERBOSE: ";
1N/A break;
1N/A case NTFS_LOG_LEVEL_PROGRESS:
1N/A prefix = "PROGRESS: ";
1N/A break;
1N/A case NTFS_LOG_LEVEL_WARNING:
1N/A prefix = "WARNING: ";
1N/A break;
1N/A case NTFS_LOG_LEVEL_ERROR:
1N/A prefix = "ERROR: ";
1N/A break;
1N/A case NTFS_LOG_LEVEL_PERROR:
1N/A prefix = "ERROR: ";
1N/A break;
1N/A case NTFS_LOG_LEVEL_CRITICAL:
1N/A prefix = "CRITICAL: ";
1N/A break;
1N/A default:
1N/A prefix = "";
1N/A break;
1N/A }
1N/A
1N/A return prefix;
1N/A}
1N/A
1N/A
1N/A/**
1N/A * ntfs_log_set_handler - Provide an alternate logging handler
1N/A * @handler: function to perform the logging
1N/A *
1N/A * This alternate handler will be called for all future logging requests.
1N/A * If no @handler is specified, logging will revert to the default handler.
1N/A */
1N/Avoid ntfs_log_set_handler(ntfs_log_handler *handler)
1N/A{
1N/A if (handler) {
1N/A ntfs_log.handler = handler;
1N/A#ifdef HAVE_SYSLOG_H
1N/A if (handler == ntfs_log_handler_syslog)
1N/A openlog("libntfs", LOG_PID, LOG_USER);
1N/A#endif
1N/A } else
1N/A ntfs_log.handler = ntfs_log_handler_null;
1N/A}
1N/A
1N/A/**
1N/A * ntfs_log_redirect - Pass on the request to the real handler
1N/A * @function: Function in which the log line occurred
1N/A * @file: File in which the log line occurred
1N/A * @line: Line number on which the log line occurred
1N/A * @level: Level at which the line is logged
1N/A * @data: User specified data, possibly specific to a handler
1N/A * @format: printf-style formatting string
1N/A * @...: Arguments to be formatted
1N/A *
1N/A * This is just a redirector function. The arguments are simply passed to the
1N/A * main logging handler (as defined in the global logging struct @ntfs_log).
1N/A *
1N/A * Returns: -1 Error occurred
1N/A * 0 Message wasn't logged
1N/A * num Number of output characters
1N/A */
1N/Aint ntfs_log_redirect(const char *function, const char *file,
1N/A int line, u32 level, void *data, const char *format, ...)
1N/A{
1N/A int olderr = errno;
1N/A int ret;
1N/A va_list args;
1N/A
1N/A if (!(ntfs_log.levels & level)) /* Don't log this message */
1N/A return 0;
1N/A
1N/A va_start(args, format);
1N/A errno = olderr;
1N/A ret = ntfs_log.handler(function, file, line, level, data, format, args);
1N/A va_end(args);
1N/A
1N/A errno = olderr;
1N/A return ret;
1N/A}
1N/A
1N/A
1N/A#ifdef HAVE_SYSLOG_H
1N/A/**
1N/A * ntfs_log_handler_syslog - syslog logging handler
1N/A * @function: Function in which the log line occurred
1N/A * @file: File in which the log line occurred
1N/A * @line: Line number on which the log line occurred
1N/A * @level: Level at which the line is logged
1N/A * @data: User specified data, possibly specific to a handler
1N/A * @format: printf-style formatting string
1N/A * @args: Arguments to be formatted
1N/A *
1N/A * A syslog logging handler. Ignores colors and truncates output after 512
1N/A * bytes.
1N/A *
1N/A * Returns: -1 Error occurred
1N/A * 0 Message wasn't logged
1N/A * num Number of output characters
1N/A */
1N/Aint ntfs_log_handler_syslog(const char *function, const char *file, int line,
1N/A u32 level, void *data __attribute__((unused)),
1N/A const char *format, va_list args)
1N/A{
1N/A char buffer[512];
1N/A int ret = 0, olderr = errno;
1N/A
1N/A if ((ntfs_log.flags & NTFS_LOG_FLAG_ONLYNAME) &&
1N/A (strchr(file, PATH_SEP))) /* Abbreviate the filename */
1N/A file = strrchr(file, PATH_SEP) + 1;
1N/A
1N/A /* Prefix the output */
1N/A if (ret < sizeof(buffer) && ntfs_log.flags & NTFS_LOG_FLAG_PREFIX)
1N/A ret += snprintf(buffer + ret, sizeof(buffer) - ret, "%s",
1N/A ntfs_log_get_prefix(level));
1N/A
1N/A /* Source filename */
1N/A if (ret < sizeof(buffer) && ntfs_log.flags & NTFS_LOG_FLAG_FILENAME)
1N/A ret += snprintf(buffer + ret, sizeof(buffer) - ret, "%s ",
1N/A file);
1N/A
1N/A /* Source line number */
1N/A if (ret < sizeof(buffer) && ntfs_log.flags & NTFS_LOG_FLAG_LINE)
1N/A ret += snprintf(buffer + ret, sizeof(buffer) - ret, "(%d) ",
1N/A line);
1N/A
1N/A /* Source function */
1N/A if (ret < sizeof(buffer) && ((ntfs_log.flags & NTFS_LOG_FLAG_FUNCTION)
1N/A || (level & NTFS_LOG_LEVEL_TRACE)))
1N/A ret += snprintf(buffer + ret, sizeof(buffer) - ret, "%s(): ",
1N/A function);
1N/A
1N/A /* Message itself */
1N/A if (ret < sizeof(buffer))
1N/A ret += vsnprintf(buffer + ret, sizeof(buffer) - ret, format,
1N/A args);
1N/A
1N/A /* Append errno */
1N/A if (ret < sizeof(buffer) && level & NTFS_LOG_LEVEL_PERROR)
1N/A ret += snprintf(buffer + ret, sizeof(buffer) - ret, ": %s.\n",
1N/A strerror(olderr));
1N/A
1N/A syslog(LOG_NOTICE, "%s", buffer);
1N/A
1N/A errno = olderr;
1N/A return ret;
1N/A}
1N/A#endif
1N/A
1N/A/**
1N/A * ntfs_log_handler_fprintf - Basic logging handler
1N/A * @function: Function in which the log line occurred
1N/A * @file: File in which the log line occurred
1N/A * @line: Line number on which the log line occurred
1N/A * @level: Level at which the line is logged
1N/A * @data: User specified data, possibly specific to a handler
1N/A * @format: printf-style formatting string
1N/A * @args: Arguments to be formatted
1N/A *
1N/A * A simple logging handler. This is where the log line is finally displayed.
1N/A * It is more likely that you will want to set the handler to either
1N/A * ntfs_log_handler_outerr or ntfs_log_handler_stderr.
1N/A *
1N/A * Note: For this handler, @data is a pointer to a FILE output stream.
1N/A * If @data is NULL, nothing will be displayed.
1N/A *
1N/A * Returns: -1 Error occurred
1N/A * 0 Message wasn't logged
1N/A * num Number of output characters
1N/A */
1N/Aint ntfs_log_handler_fprintf(const char *function, const char *file,
1N/A int line, u32 level, void *data, const char *format, va_list args)
1N/A{
1N/A int ret = 0;
1N/A int olderr = errno;
1N/A FILE *stream;
1N/A const char *col_prefix = NULL;
1N/A const char *col_suffix = NULL;
1N/A
1N/A if (!data) /* Interpret data as a FILE stream. */
1N/A return 0; /* If it's NULL, we can't do anything. */
1N/A stream = (FILE*)data;
1N/A
1N/A if (ntfs_log.flags & NTFS_LOG_FLAG_COLOUR) {
1N/A /* Pick a colour determined by the log level */
1N/A switch (level) {
1N/A case NTFS_LOG_LEVEL_DEBUG:
1N/A col_prefix = col_green;
1N/A col_suffix = col_end;
1N/A break;
1N/A case NTFS_LOG_LEVEL_TRACE:
1N/A col_prefix = col_cyan;
1N/A col_suffix = col_end;
1N/A break;
1N/A case NTFS_LOG_LEVEL_WARNING:
1N/A col_prefix = col_yellow;
1N/A col_suffix = col_end;
1N/A break;
1N/A case NTFS_LOG_LEVEL_ERROR:
1N/A case NTFS_LOG_LEVEL_PERROR:
1N/A col_prefix = col_red;
1N/A col_suffix = col_end;
1N/A break;
1N/A case NTFS_LOG_LEVEL_CRITICAL:
1N/A col_prefix = col_redinv;
1N/A col_suffix = col_end;
1N/A break;
1N/A }
1N/A }
1N/A
1N/A if (col_prefix)
1N/A ret += fprintf(stream, col_prefix);
1N/A
1N/A if ((ntfs_log.flags & NTFS_LOG_FLAG_ONLYNAME) &&
1N/A (strchr(file, PATH_SEP))) /* Abbreviate the filename */
1N/A file = strrchr(file, PATH_SEP) + 1;
1N/A
1N/A if (ntfs_log.flags & NTFS_LOG_FLAG_PREFIX) /* Prefix the output */
1N/A ret += fprintf(stream, "%s", ntfs_log_get_prefix(level));
1N/A
1N/A if (ntfs_log.flags & NTFS_LOG_FLAG_FILENAME) /* Source filename */
1N/A ret += fprintf(stream, "%s ", file);
1N/A
1N/A if (ntfs_log.flags & NTFS_LOG_FLAG_LINE) /* Source line number */
1N/A ret += fprintf(stream, "(%d) ", line);
1N/A
1N/A if ((ntfs_log.flags & NTFS_LOG_FLAG_FUNCTION) || /* Source function */
1N/A (level & NTFS_LOG_LEVEL_TRACE))
1N/A ret += fprintf(stream, "%s(): ", function);
1N/A
1N/A ret += vfprintf(stream, format, args);
1N/A
1N/A if (level & NTFS_LOG_LEVEL_PERROR)
1N/A ret += fprintf(stream, ": %s.\n", strerror(olderr));
1N/A
1N/A if (col_suffix)
1N/A ret += fprintf(stream, col_suffix);
1N/A
1N/A
1N/A fflush(stream);
1N/A errno = olderr;
1N/A return ret;
1N/A}
1N/A
1N/A/**
1N/A * ntfs_log_handler_null - Null logging handler (no output)
1N/A * @function: Function in which the log line occurred
1N/A * @file: File in which the log line occurred
1N/A * @line: Line number on which the log line occurred
1N/A * @level: Level at which the line is logged
1N/A * @data: User specified data, possibly specific to a handler
1N/A * @format: printf-style formatting string
1N/A * @args: Arguments to be formatted
1N/A *
1N/A * This handler produces no output. It provides a way to temporarily disable
1N/A * logging, without having to change the levels and flags.
1N/A *
1N/A * Returns: 0 Message wasn't logged
1N/A */
1N/Aint ntfs_log_handler_null(const char *function __attribute__((unused)), const char *file __attribute__((unused)),
1N/A int line __attribute__((unused)), u32 level __attribute__((unused)), void *data __attribute__((unused)),
1N/A const char *format __attribute__((unused)), va_list args __attribute__((unused)))
1N/A{
1N/A return 0;
1N/A}
1N/A
1N/A/**
1N/A * ntfs_log_handler_stdout - All logs go to stdout
1N/A * @function: Function in which the log line occurred
1N/A * @file: File in which the log line occurred
1N/A * @line: Line number on which the log line occurred
1N/A * @level: Level at which the line is logged
1N/A * @data: User specified data, possibly specific to a handler
1N/A * @format: printf-style formatting string
1N/A * @args: Arguments to be formatted
1N/A *
1N/A * Display a log message to stdout.
1N/A *
1N/A * Note: For this handler, @data is a pointer to a FILE output stream.
1N/A * If @data is NULL, then stdout will be used.
1N/A *
1N/A * Note: This function calls ntfs_log_handler_fprintf to do the main work.
1N/A *
1N/A * Returns: -1 Error occurred
1N/A * 0 Message wasn't logged
1N/A * num Number of output characters
1N/A */
1N/Aint ntfs_log_handler_stdout(const char *function, const char *file,
1N/A int line, u32 level, void *data, const char *format, va_list args)
1N/A{
1N/A if (!data)
1N/A data = stdout;
1N/A
1N/A return ntfs_log_handler_fprintf(function, file, line, level, data, format, args);
1N/A}
1N/A
1N/A/**
1N/A * ntfs_log_handler_outerr - Logs go to stdout/stderr depending on level
1N/A * @function: Function in which the log line occurred
1N/A * @file: File in which the log line occurred
1N/A * @line: Line number on which the log line occurred
1N/A * @level: Level at which the line is logged
1N/A * @data: User specified data, possibly specific to a handler
1N/A * @format: printf-style formatting string
1N/A * @args: Arguments to be formatted
1N/A *
1N/A * Display a log message. The output stream will be determined by the log
1N/A * level.
1N/A *
1N/A * Note: For this handler, @data is a pointer to a FILE output stream.
1N/A * If @data is NULL, the function ntfs_log_get_stream will be called
1N/A *
1N/A * Note: This function calls ntfs_log_handler_fprintf to do the main work.
1N/A *
1N/A * Returns: -1 Error occurred
1N/A * 0 Message wasn't logged
1N/A * num Number of output characters
1N/A */
1N/Aint ntfs_log_handler_outerr(const char *function, const char *file,
1N/A int line, u32 level, void *data, const char *format, va_list args)
1N/A{
1N/A if (!data)
1N/A data = ntfs_log_get_stream(level);
1N/A
1N/A return ntfs_log_handler_fprintf(function, file, line, level, data, format, args);
1N/A}
1N/A
1N/A/**
1N/A * ntfs_log_handler_stderr - All logs go to stderr
1N/A * @function: Function in which the log line occurred
1N/A * @file: File in which the log line occurred
1N/A * @line: Line number on which the log line occurred
1N/A * @level: Level at which the line is logged
1N/A * @data: User specified data, possibly specific to a handler
1N/A * @format: printf-style formatting string
1N/A * @args: Arguments to be formatted
1N/A *
1N/A * Display a log message to stderr.
1N/A *
1N/A * Note: For this handler, @data is a pointer to a FILE output stream.
1N/A * If @data is NULL, then stdout will be used.
1N/A *
1N/A * Note: This function calls ntfs_log_handler_fprintf to do the main work.
1N/A *
1N/A * Returns: -1 Error occurred
1N/A * 0 Message wasn't logged
1N/A * num Number of output characters
1N/A */
1N/Aint ntfs_log_handler_stderr(const char *function, const char *file,
1N/A int line, u32 level, void *data, const char *format, va_list args)
1N/A{
1N/A if (!data)
1N/A data = stderr;
1N/A
1N/A return ntfs_log_handler_fprintf(function, file, line, level, data, format, args);
1N/A}
1N/A
1N/A
1N/A/**
1N/A * ntfs_log_parse_option - Act upon command line options
1N/A * @option: Option flag
1N/A *
1N/A * Delegate some of the work of parsing the command line. All the options begin
1N/A * with "--log-". Options cause log levels to be enabled in @ntfs_log (the
1N/A * global logging structure).
1N/A *
1N/A * Note: The "colour" option changes the logging handler.
1N/A *
1N/A * Returns: TRUE Option understood
1N/A * FALSE Invalid log option
1N/A */
1N/ABOOL ntfs_log_parse_option(const char *option)
1N/A{
1N/A if (strcmp(option, "--log-debug") == 0) {
1N/A ntfs_log_set_levels(NTFS_LOG_LEVEL_DEBUG);
1N/A return TRUE;
1N/A } else if (strcmp(option, "--log-verbose") == 0) {
1N/A ntfs_log_set_levels(NTFS_LOG_LEVEL_VERBOSE);
1N/A return TRUE;
1N/A } else if (strcmp(option, "--log-quiet") == 0) {
1N/A ntfs_log_clear_levels(NTFS_LOG_LEVEL_QUIET);
1N/A return TRUE;
1N/A } else if (strcmp(option, "--log-trace") == 0) {
1N/A ntfs_log_set_levels(NTFS_LOG_LEVEL_TRACE);
1N/A return TRUE;
1N/A } else if ((strcmp(option, "--log-colour") == 0) ||
1N/A (strcmp(option, "--log-color") == 0)) {
1N/A ntfs_log_set_flags(NTFS_LOG_FLAG_COLOUR);
1N/A return TRUE;
1N/A }
1N/A
1N/A ntfs_log_debug("Unknown logging option '%s'\n", option);
1N/A return FALSE;
1N/A}
1N/A