Add sub-controls for Hack array compat runtime checks
[hiphop-php.git] / hphp / runtime / base / extended-logger.h
blob29c1828268f0e5a883a5a73dc2981c7bd3235ba9
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
16 #ifndef incl_HPHP_RUNTIME_BASE_EXTENDED_LOGGER_H_
17 #define incl_HPHP_RUNTIME_BASE_EXTENDED_LOGGER_H_
19 #include "hphp/util/exception.h"
20 #include "hphp/util/logger.h"
22 namespace HPHP {
23 ///////////////////////////////////////////////////////////////////////////////
25 struct Array;
26 struct StackTrace;
28 struct ExtendedLogger : Logger {
29 static bool EnabledByDefault;
30 // These logging functions will also print stacktrace at end of each message.
31 static void Error(const std::string &msg);
32 static void Warning(const std::string &msg);
33 static void Info(const std::string &msg);
34 static void Verbose(const std::string &msg);
36 static void Error(ATTRIBUTE_PRINTF_STRING const char *fmt, ...)
37 ATTRIBUTE_PRINTF(1,2);
38 static void Warning(ATTRIBUTE_PRINTF_STRING const char *fmt, ...)
39 ATTRIBUTE_PRINTF(1,2);
40 static void Info(ATTRIBUTE_PRINTF_STRING const char *fmt, ...)
41 ATTRIBUTE_PRINTF(1,2);
42 static void Verbose(ATTRIBUTE_PRINTF_STRING const char *fmt, ...)
43 ATTRIBUTE_PRINTF(1,2);
45 // Convenience functions for stringifying.
46 static std::string StringOfStackTrace(const Array& stackTrace);
48 private:
49 static void LogImpl(LogLevelType level, const std::string &msg);
51 static std::string StringOfFrame(const Array& frame, int i,
52 bool escape = false);
53 std::pair<int, int> log(LogLevelType level, const std::string &msg,
54 const StackTrace *stackTrace,
55 bool escape = true, bool escapeMore = false) override;
56 static int PrintStackTrace(FILE *f, const Array& stackTrace,
57 bool escape = false);
60 ///////////////////////////////////////////////////////////////////////////////
63 #endif // incl_HPHP_RUNTIME_BASE_EXTENDED_LOGGER_H_