Title: [252068] trunk/Source/WTF
Revision
252068
Author
[email protected]
Date
2019-11-05 11:53:49 -0800 (Tue, 05 Nov 2019)

Log Message

Add definitions of ANSI colors for colorful log output
https://bugs.webkit.org/show_bug.cgi?id=203805

Patch by Tuomas Karkkainen <[email protected]> on 2019-11-05
Reviewed by Saam Barati.

* WTF.xcodeproj/project.pbxproj:
* wtf/AnsiColors.h: Added.
* wtf/CMakeLists.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (252067 => 252068)


--- trunk/Source/WTF/ChangeLog	2019-11-05 19:53:40 UTC (rev 252067)
+++ trunk/Source/WTF/ChangeLog	2019-11-05 19:53:49 UTC (rev 252068)
@@ -1,5 +1,16 @@
 2019-11-05  Tuomas Karkkainen  <[email protected]>
 
+        Add definitions of ANSI colors for colorful log output
+        https://bugs.webkit.org/show_bug.cgi?id=203805
+
+        Reviewed by Saam Barati.
+
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/AnsiColors.h: Added.
+        * wtf/CMakeLists.txt:
+
+2019-11-05  Tuomas Karkkainen  <[email protected]>
+
         move CrashReporterClientSPI.h and parts of WKCrashReporter to WTF so it can be used in _javascript_Core
         https://bugs.webkit.org/show_bug.cgi?id=203803
 

Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (252067 => 252068)


--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2019-11-05 19:53:40 UTC (rev 252067)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2019-11-05 19:53:49 UTC (rev 252068)
@@ -652,6 +652,7 @@
 		CD6D9FCD1EEF3AD4008B0671 /* Algorithms.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Algorithms.h; sourceTree = "<group>"; };
 		CD7600FF1F90A3CA00026E26 /* UnsafePointer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UnsafePointer.h; sourceTree = "<group>"; };
 		CDCC9BC422382FCE00FFB51C /* AggregateLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AggregateLogger.h; path = wtf/AggregateLogger.h; sourceTree = SOURCE_ROOT; };
+		CE1132832370634900A8C83B /* AnsiColors.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AnsiColors.h; sourceTree = "<group>"; };
 		CE73E02419DCB7AB00580D5C /* XPCSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPCSPI.h; sourceTree = "<group>"; };
 		CEA072A7236FFA160018839C /* CrashReporterClientSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CrashReporterClientSPI.h; sourceTree = "<group>"; };
 		CEA072A8236FFBF70018839C /* CrashReporter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CrashReporter.h; sourceTree = "<group>"; };
@@ -878,6 +879,7 @@
 				A8A47348151A825B004123FF /* unicode */,
 				CDCC9BC422382FCE00FFB51C /* AggregateLogger.h */,
 				CD6D9FCD1EEF3AD4008B0671 /* Algorithms.h */,
+				CE1132832370634900A8C83B /* AnsiColors.h */,
 				4427C5A921F6D6C300A612A4 /* ASCIICType.cpp */,
 				A8A4725A151A825A004123FF /* ASCIICType.h */,
 				A8A4725B151A825A004123FF /* Assertions.cpp */,

Added: trunk/Source/WTF/wtf/AnsiColors.h (0 => 252068)


--- trunk/Source/WTF/wtf/AnsiColors.h	                        (rev 0)
+++ trunk/Source/WTF/wtf/AnsiColors.h	2019-11-05 19:53:49 UTC (rev 252068)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if PLATFORM(WIN)
+
+#define RESET
+#define ANSI_COLOR(COLOR)
+
+#else
+
+#define CSI "\033["
+#define RESET , CSI "0m"
+#define ANSI_COLOR(COLOR) CSI COLOR,
+
+#endif
+
+#define BLACK(CONTENT) ANSI_COLOR("30m") CONTENT RESET
+#define RED(CONTENT) ANSI_COLOR("31m") CONTENT RESET
+#define GREEN(CONTENT) ANSI_COLOR("32m") CONTENT RESET
+#define YELLOW(CONTENT) ANSI_COLOR("33m") CONTENT RESET
+#define BLUE(CONTENT) ANSI_COLOR("34m") CONTENT RESET
+#define MAGENTA(CONTENT) ANSI_COLOR("35m") CONTENT RESET
+#define CYAN(CONTENT) ANSI_COLOR("36m") CONTENT RESET
+#define WHITE(CONTENT) ANSI_COLOR("37m") CONTENT RESET
+
+#define BOLD(CONTENT) ANSI_COLOR("1m") CONTENT RESET
+

Modified: trunk/Source/WTF/wtf/CMakeLists.txt (252067 => 252068)


--- trunk/Source/WTF/wtf/CMakeLists.txt	2019-11-05 19:53:40 UTC (rev 252067)
+++ trunk/Source/WTF/wtf/CMakeLists.txt	2019-11-05 19:53:49 UTC (rev 252068)
@@ -2,6 +2,7 @@
     ASCIICType.h
     AggregateLogger.h
     Algorithms.h
+    AnsiColors.h
     Assertions.h
     Atomics.h
     AutodrainedPool.h
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to