Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
move PRINTF() style wrapper macros for logprintf() from misc.h to log.h
Browse files Browse the repository at this point in the history
  • Loading branch information
juphoff committed Aug 9, 2012
1 parent a432570 commit c253d3f
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 38 deletions.
53 changes: 35 additions & 18 deletions util/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
// vim: set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:

/*
Copyright (c) 2009 Eucalyptus Systems, Inc.
Copyright (c) 2009 Eucalyptus Systems, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, only version 3 of the License.
it under the terms of the GNU General Public License as published by
the Free Software Foundation, only version 3 of the License.
This file is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
for more details.
You should have received a copy of the GNU General Public License along
with this program. If not, see <http://www.gnu.org/licenses/>.
Please contact Eucalyptus Systems, Inc., 130 Castilian
Dr., Goleta, CA 93101 USA or visit <http://www.eucalyptus.com/licenses/>
Dr., Goleta, CA 93101 USA or visit <http://www.eucalyptus.com/licenses/>
if you need additional information or have any questions.
This file may incorporate work covered under the following copyright and
Expand All @@ -26,7 +26,7 @@ permission notice:
Software License Agreement (BSD License)
Copyright (c) 2008, Regents of the University of California
Redistribution and use of this software in source and binary forms, with
or without modification, are permitted provided that the following
Expand Down Expand Up @@ -65,15 +65,15 @@ permission notice:
#define LOG_H

enum {
EUCAALL=0,
EUCATRACE,
EUCADEBUG3,
EUCADEBUG2,
EUCADEBUG,
EUCAINFO,
EUCAWARN,
EUCAERROR,
EUCAFATAL,
EUCAALL=0,
EUCATRACE,
EUCADEBUG3,
EUCADEBUG2,
EUCADEBUG,
EUCAINFO,
EUCAWARN,
EUCAERROR,
EUCAFATAL,
EUCAOFF
};

Expand All @@ -90,6 +90,24 @@ static char * log_level_names [] = {
"OFF"
};

#ifdef DEBUG
#define PRINTF(a) logprintf a
#else
#define PRINTF(a)
#endif

#ifdef DEBUG1
#define PRINTF1(a) logprintf a
#else
#define PRINTF1(a)
#endif

#ifdef DEBUGXML
#define PRINTF_XML(a) logprintf a
#else
#define PRINTF_XML(a)
#endif

int log_level_int(const char *level);
void log_params_set(int log_level_in, int log_roll_number_in, long log_max_size_bytes_in);
void log_params_get(int *log_level_out, int *log_roll_number_out, long *log_max_size_bytes_out);
Expand All @@ -102,4 +120,3 @@ int logcat (int debug_level, const char * file_name);
void eventlog(char *hostTag, char *userTag, char *cid, char *eventTag, char *other);

#endif

22 changes: 2 additions & 20 deletions util/misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ char *getConfString(char configFiles[][MAX_PATH], int numFiles, char *key);
/**
* Search in file #path# for a variable named #name#. It will put
* whatever after the = in value (which will need to be freed by the
* caller).
* caller).
*
* Returns -1 on error (open file, out of memory, parse error ...)
* Returns -1 on error (open file, out of memory, parse error ...)
* 0 if variable not found in file
* 1 if found and value is indeed valid
*
Expand Down Expand Up @@ -165,24 +165,6 @@ char parse_boolean (const char * s);
int param_check(char *func, ...);
// end of dan't functions

#ifdef DEBUG
#define PRINTF(a) logprintf a
#else
#define PRINTF(a)
#endif

#ifdef DEBUG1
#define PRINTF1(a) logprintf a
#else
#define PRINTF1(a)
#endif

#ifdef DEBUGXML
#define PRINTF_XML(a) logprintf a
#else
#define PRINTF_XML(a)
#endif

int hash_code (const char * s);
char * get_string_stats (const char * s);
int daemonrun(char *cmd, char *pidfile);
Expand Down

0 comments on commit c253d3f

Please sign in to comment.