/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include "Trace.h"
#include <cstdarg>
#include <string>
#include <cstdio>
#include <string>
#include <fcntl.h>
#include <unistd.h>
using namespace std;
/**
* Tracking for the stacks
*/
/**
* The indentation string for output
*/
/**
* @memo Log a message
* @param priority The priority of the message (see syslog man page)
* @param msg The message string
*
* @doc If the debug file is present, we will log everything to
* that file. Otherwise, if the normal log file is present,
* we'll log all non-debug messages to that file. Lastly,
* if neither file is present, the message will be
* silently discarded.
*/
int fd;
// char time[CTIME_LEN+1];
/* If we can open the log file, write there, else use the cim log */
if (fd == -1) {
/* No debug file, how about the log file? */
return; /* Ignore debug */
}
/* We catch open failures later */
}
// now(time);
/* First interpret the priority value */
switch (priority) {
case INTERNAL_ERROR:
priString = "INTERNAL";
break;
case STACK_TRACE:
priString = "STACK";
break;
case IO_ERROR:
priString = "IO";
break;
case USER_ERROR:
priString = "USER";
break;
case LOG_DEBUG:
priString = "DEBUG";
break;
default:
priString = "UNKNOWN";
break;
}
if (fd != -1) {
/* Format the prefix string for the log file */
tid,
/* Format the message string for the log file */
msg);
} /* Else discard the log message */
}
/**
* @memo Create a new Trace instance and update stack.
* @param myRoutine The name of the routine
*
* @doc This class was developed to provide a Java
* like stack trace capability, as C++ does not provide
* a run-time stack lookup feature. Instances of the
* Trace class should be created on the stack so they
* will be automatically freed when the stack is popped
* when the function returns.
*/
tid = pthread_self();
}
}
/**
* @memo Delete a trace instances and update the stack
*/
if (len > 0) {
}
}
/**
* @memo Print out the current stack trace information
*/
if (i == 0) {
break;
}
}
}