MongoDB  2.7.0
stacktrace.h
1 /* Copyright 2009 10gen Inc.
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
20 #pragma once
21 
22 #include <iostream>
23 
24 #include "mongo/util/log.h"
25 
26 namespace mongo {
27 
28  // Print stack trace information to "os", default to the log stream.
29  void printStackTrace(std::ostream &os=log().stream());
30 
31 #if defined(_WIN32)
32  // Print stack trace (using a specified stack context) to "os", default to the log stream.
33  void printWindowsStackTrace(CONTEXT &context, std::ostream &os=log().stream());
34 
35  // Print error message from C runtime followed by stack trace
36  int crtDebugCallback(int, char* originalMessage, int*);
37 #endif
38 
39 } // namespace mongo
LogstreamBuilder log()
Returns a LogstreamBuilder for logging a message with LogSeverity::Log().
Definition: log.h:69
void printStackTrace(std::ostream &os)
Print a stack backtrace for the current thread to the specified ostream.
Definition: stacktrace.cpp:302