<commit_before>/* $chaos: log.c,v 1.2 2002/10/04 19:01:17 per Exp $ */
/* Abstract: Kernel log module. */
/* Author: <NAME> <<EMAIL>> */

/* Copyright 2002 chaos development. */
/* Use freely under the terms listed in the file LICENSE. */

#include <storm/storm.h>
#include <log/log.h>

/* The version of log service that we provide. */
#define LOG_SERVICE_VERSION             1

static char *log_urgency[] =
{
    "Emergency",
    "Error",
    "Warning",
    "Informative",
    "Debug"
};

/* Print something to the kernel log. */
static return_t log_print (unsigned int urgency, char *string)
{
    debug_print ("%s: %s\n", log_urgency[urgency], string);
    return STORM_RETURN_SUCCESS;
}

/* Print something to the kernel log, in a more formatted fashion. */
static return_t log_print_formatted (unsigned int urgency, char *string, ...)
{
    // FIXME: Use the varargs as well.
    debug_print ("%s: %s\n", log_urgency[urgency], string);
    return STORM_RETURN_SUCCESS;
}

/* Return some information about the log service (function pointers to
   our functionality). */
static return_t service_info (void *log_void)
{
    log_service_t *log = (log_service_t *) log_void;
    log->magic_cookie = LOG_COOKIE;
    log->print = &log_print;
    log->print_formatted = &log_print_formatted;
    return STORM_RETURN_SUCCESS;
}

return_t module_start (void)
{
    // FIXME: Use log_register (bug #54)
    return service_register ("log", "chaos development", "Log module", "1", LOG_SERVICE_MAJOR_VERSION, LOG_SERVICE_MINOR_VERSION, &service_info);
}<commit_msg>Use new log_register () function.<commit_after>/* $chaos: log.c,v 1.2 2002/10/04 19:01:17 per Exp $ */
/* Abstract: Kernel log module. */
/* Author: <NAME> <<EMAIL>> */

/* Copyright 2002 chaos development. */
/* Use freely under the terms listed in the file LICENSE. */

#include <storm/storm.h>
#include <log/log.h>

/* The version of log service that we provide. */
#define LOG_SERVICE_VERSION             1

/* Log urgency names. */
static char *log_urgency[] =
{
    "Emergency",
    "Error",
    "Warning",
    "Informative",
    "Debug"
};

/* Print something to the kernel log. */
static return_t log_print (unsigned int urgency, char *string)
{
    debug_print ("%s: %s\n", log_urgency[urgency], string);
    return STORM_RETURN_SUCCESS;
}

/* Print something to the kernel log, in a more formatted fashion. */
static return_t log_print_formatted (unsigned int urgency, char *string, ...)
{
    // FIXME: Use the varargs as well.
    debug_print ("%s: %s\n", log_urgency[urgency], string);
    return STORM_RETURN_SUCCESS;
}

/* Return some information about the log service (function pointers to
   our functionality). */
static return_t service_info (void *log_void)
{
    log_service_t *log = (log_service_t *) log_void;
    log->magic_cookie = LOG_COOKIE;
    log->print = &log_print;
    log->print_formatted = &log_print_formatted;
    return STORM_RETURN_SUCCESS;
}

return_t module_start (void)
{
    service_register_t service_register_info;
    service_register_info.vendor = "chaos development";
    service_register_info.model = "Log module";
    service_register_info.device_id = "1";
    service_register_info.info_handler = &service_info;

    // FIXME: Fill in this structure.
    service_method_t service_method[] = 
        {
            { -1, NULL }
        };

    return log_register (&service_register_info, service_method);
}
{'fraction_non_alphanumeric': 0.12448740480374927, 'fraction_numerical': 0.013766842413591095, 'mean_word_length': 3.5838926174496644, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '481841', 'n_tokens_mistral': 1145, 'n_tokens_neox': 1102, 'n_words': 321}