log.c revision 6017f424ee3c02d7f22132c77576ea38542fa949
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence/*
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence * Copyright (C) 1999 Internet Software Consortium.
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence *
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence * Permission to use, copy, modify, and distribute this software for any
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence * purpose with or without fee is hereby granted, provided that the above
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence * copyright notice and this permission notice appear in all copies.
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence *
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence * SOFTWARE.
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence */
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence
6017f424ee3c02d7f22132c77576ea38542fa949Andreas Gustafsson/* $Id: log.c,v 1.9 1999/12/16 23:11:05 gson Exp $ */
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence/* Principal Authors: DCL */
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence#include <isc/assertions.h>
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence#include <isc/log.h>
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence#include <isc/result.h>
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence#include <dns/log.h>
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence#include <dns/result.h>
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence/*
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence * When adding a new category, be sure to add the appropriate
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence * #define to <dns/log.h>.
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence */
fc80027fb54b501cdd88461bf879d078259e0226David Lawrenceisc_logcategory_t dns_categories[] = {
e9efde0ef217223a63c8060b5b53f9fdc4a8d6b0Bob Halley { "dns_general", 0 },
e9efde0ef217223a63c8060b5b53f9fdc4a8d6b0Bob Halley { "dns_database", 0 },
e9efde0ef217223a63c8060b5b53f9fdc4a8d6b0Bob Halley { "dns_security", 0 },
e9efde0ef217223a63c8060b5b53f9fdc4a8d6b0Bob Halley { "dns_config", 0 },
e9efde0ef217223a63c8060b5b53f9fdc4a8d6b0Bob Halley { "dns_parser", 0 },
e9efde0ef217223a63c8060b5b53f9fdc4a8d6b0Bob Halley { "dns_resolver", 0 },
81ae5e1ae678320e46342d4bbb71bfb81227a248Andreas Gustafsson { "dns_xfer_in", 0 },
81ae5e1ae678320e46342d4bbb71bfb81227a248Andreas Gustafsson { "dns_xfer_out", 0 },
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence { NULL, 0 }
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence};
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence/*
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence * When adding a new module, be sure to add the appropriate
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence * #define to <dns/log.h>.
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence */
fc80027fb54b501cdd88461bf879d078259e0226David Lawrenceisc_logmodule_t dns_modules[] = {
e9efde0ef217223a63c8060b5b53f9fdc4a8d6b0Bob Halley { "dns/db", 0 },
e9efde0ef217223a63c8060b5b53f9fdc4a8d6b0Bob Halley { "dns/rbtdb", 0 },
e9efde0ef217223a63c8060b5b53f9fdc4a8d6b0Bob Halley { "dns/rbtdb64", 0 },
e9efde0ef217223a63c8060b5b53f9fdc4a8d6b0Bob Halley { "dns/rbt", 0 },
e9efde0ef217223a63c8060b5b53f9fdc4a8d6b0Bob Halley { "dns/rdata", 0 },
e9efde0ef217223a63c8060b5b53f9fdc4a8d6b0Bob Halley { "dns/master", 0 },
e9efde0ef217223a63c8060b5b53f9fdc4a8d6b0Bob Halley { "dns/message", 0 },
e9efde0ef217223a63c8060b5b53f9fdc4a8d6b0Bob Halley { "dns/cache", 0 },
e9efde0ef217223a63c8060b5b53f9fdc4a8d6b0Bob Halley { "dns/config", 0 },
e9efde0ef217223a63c8060b5b53f9fdc4a8d6b0Bob Halley { "dns/resolver", 0 },
70f6053bd1c18f0a0ebe5b52c8ddbf464e92a1c5Mark Andrews { "dns/zone", 0 },
61ba96e2f90930c7dfde73e05ac6d2c5a611afa7Andreas Gustafsson { "dns/journal", 0 },
09f041a8dfac8efa21eed2d8a28a56b3d3de0f6aMichael Graff { "dns/adb", 0 },
81ae5e1ae678320e46342d4bbb71bfb81227a248Andreas Gustafsson { "dns/xfrin", 0 },
81ae5e1ae678320e46342d4bbb71bfb81227a248Andreas Gustafsson { "dns/xfrout", 0 },
6017f424ee3c02d7f22132c77576ea38542fa949Andreas Gustafsson { "dns/acl", 0 },
e9efde0ef217223a63c8060b5b53f9fdc4a8d6b0Bob Halley { NULL, 0 }
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence};
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence
fc80027fb54b501cdd88461bf879d078259e0226David Lawrenceisc_log_t *dns_lctx;
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence
fc80027fb54b501cdd88461bf879d078259e0226David Lawrencedns_result_t
fc80027fb54b501cdd88461bf879d078259e0226David Lawrencedns_log_init(isc_log_t *lctx) {
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence isc_result_t result;
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence REQUIRE(dns_lctx == NULL);
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence result = isc_log_registercategories(lctx, dns_categories);
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence if (result == ISC_R_SUCCESS) {
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence isc_log_registermodules(lctx, dns_modules);
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence dns_lctx = lctx;
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence }
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence return (result);
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence}