Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jGIVX-0004q3-3W for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Mar 2020 08:32:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jGIVV-0004xm-DH for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Mar 2020 08:32:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jGIVU-0004xD-Eb for pgsql-hackers@lists.postgresql.org; Mon, 23 Mar 2020 08:32:25 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jGIVL-0005vF-8U for pgsql-hackers@postgresql.org; Mon, 23 Mar 2020 08:32:23 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 751EB5C004A; Mon, 23 Mar 2020 04:32:12 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 23 Mar 2020 04:32:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=ob1PlY 78pi7sxqgNuwUVQ+5LrJrONowF4INnt1avIwA=; b=hOW3N21hgmXVqrJ7l8qBXU vjc5pE59Y1C1SWK2PjBP8xFWr2Kd5JYq0GegMb7Tzt0W0e5w+D/gO7iwyDP7B9qk 0Rs6hiLvg38xXx9JBqsDcGrv3vnN2KiZlbAFo8K65OSdhrU5Q5+dnStjthVz4mHN DawugVoLHntja/+WP3eaPbzX6UY8gAYNYklX90nLlaNyd4YsgxhxwtMLyO0Io9ia ziFRyQ1+q2o+gomiDoNOjMM3jy6kah5ajvL+sZDPjUEomAHSXfTog3qmD5r001FK kDeJFlKXxKxmVJzmgs0ooOFD7VXB42IVRw+YFUGw0LQ522552eL6TtvFjKAu6R6w == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrudegjedguddtlecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefuvfhfhfhokffffgggjggtsehmtderredtfeehnecuhfhrohhmpefrvght vghrucfgihhsvghnthhrrghuthcuoehpvghtvghrrdgvihhsvghnthhrrghuthesvdhnug hquhgrughrrghnthdrtghomheqnecuffhomhgrihhnpedvnhguqhhurggurhgrnhhtrdgt ohhmnecukfhppeelfedrvdegvddrvddufedrvdegudenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpvghtvghrrdgvihhsvghnthhrrghuthes vdhnughquhgrughrrghnthdrtghomh X-ME-Proxy: Received: from april.pezone.net (p5df2d5f1.dip0.t-ipconnect.de [93.242.213.241]) by mail.messagingengine.com (Postfix) with ESMTPA id 464D0328005D; Mon, 23 Mar 2020 04:32:10 -0400 (EDT) Subject: Re: color by default To: Michael Paquier , Bruce Momjian References: <0e03c747-a48d-912e-325d-5051b593c332@archidevsys.co.nz> <20200106053824.GO3598@paquier.xyz> <171d92f5-fc29-a207-3db9-c16c63bb2ea7@archidevsys.co.nz> <20200303053101.GH32059@paquier.xyz> <20200320021557.GC1850@momjian.us> <20200321025522.GD10066@momjian.us> <6707.1584760507@sss.pgh.pa.us> <20200321032207.GE10066@momjian.us> <20200323050410.GE2900@paquier.xyz> Cc: Tom Lane , =?UTF-8?Q?Juan_Jos=c3=a9_Santamar=c3=ada_Flecha?= , Gavin Flower , Robert Haas , pgsql-hackers From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: Date: Mon, 23 Mar 2020 09:32:08 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20200323050410.GE2900@paquier.xyz> Content-Type: multipart/mixed; boundary="------------2337E035DF652AF82165040A" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------2337E035DF652AF82165040A Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit On 2020-03-23 06:04, Michael Paquier wrote: > On Fri, Mar 20, 2020 at 11:22:07PM -0400, Bruce Momjian wrote: >> On Fri, Mar 20, 2020 at 11:15:07PM -0400, Tom Lane wrote: >>> Yeah, but the point is precisely that pg_logging_init() >>> also responds to PG_COLORS, which is not documented anywhere. >> >> Oh, I thought it was a typo. OK, so it still an open item. > > Yes, I really think that we should have a new section in the docs for > that with more meaningful examples rather than copy-paste that stuff > across more pages of the docs. Note that 5aaa584 has plugged all the > holes related to PG_COLOR I could find, and that pg_ctl and pg_upgrade > initialize logging with pg_logging_init() but these two cannot use > coloring because they have their own idea of what logging should be. I'm giving up on making color the default, since there is clearly no consensus. Attached is the documentation patch reworked. Should we delete all the repetitive mentions on the man pages? -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services --------------2337E035DF652AF82165040A Content-Type: text/plain; charset=UTF-8; x-mac-type="0"; x-mac-creator="0"; name="v2-0001-Document-color-support.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v2-0001-Document-color-support.patch" From 7164d4196ace14a1acc9077a7a4d32e57131ff6e Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 23 Mar 2020 09:22:50 +0100 Subject: [PATCH v2] Document color support Add a documentation appendix that explains the PG_COLOR and PG_COLORS environment variables. --- doc/src/sgml/color.sgml | 71 ++++++++++++++++++++++++++++++++++++++ doc/src/sgml/filelist.sgml | 1 + doc/src/sgml/postgres.sgml | 1 + 3 files changed, 73 insertions(+) create mode 100644 doc/src/sgml/color.sgml diff --git a/doc/src/sgml/color.sgml b/doc/src/sgml/color.sgml new file mode 100644 index 0000000000..c30b1942a5 --- /dev/null +++ b/doc/src/sgml/color.sgml @@ -0,0 +1,71 @@ + + + + Color Support + + + color + + + + Most programs in the PostgreSQL package can produce colorized console + output. This appendix describes how that is configured. + + + + When Color is Used + + + To use colorized output, set the environment variable + PG_COLORPG_COLOR + as follows: + + + + + If the value is always, then color is used. + + + + + + If the value is auto and the standard error stream + is associated with a terminal device, then color is used. + + + + + + Otherwise, color is not used. + + + + + + + + Configuring the Colors + + + The actual colors to be used are configured using the environment variable + PG_COLORSPG_COLORS + (note plural). The value is a colon-separated list of + key=value + pairs. The keys specify what the color is to be used for. The values are + SGR (Select Graphic Rendition) specifications, which are interpreted by the + terminal. + + + + The default value is error=01;31:warning=01;35:locus=01. + + + + + This color specification format is also used by other software packages + such as GCC, GNU + coreutils, and GNU grep. + + + + diff --git a/doc/src/sgml/filelist.sgml b/doc/src/sgml/filelist.sgml index 3da2365ea9..1043d0f7ab 100644 --- a/doc/src/sgml/filelist.sgml +++ b/doc/src/sgml/filelist.sgml @@ -170,6 +170,7 @@ + diff --git a/doc/src/sgml/postgres.sgml b/doc/src/sgml/postgres.sgml index e59cba7997..1f7bd32878 100644 --- a/doc/src/sgml/postgres.sgml +++ b/doc/src/sgml/postgres.sgml @@ -278,6 +278,7 @@ Appendixes &docguide; &limits; &acronyms; + &color; -- 2.25.0 --------------2337E035DF652AF82165040A--