There is a debug menu of NuttX configuration in which you can enable
different levels of logging. You could add an option to differentiate
colours based on debug level. I think this would be both great and doable.

Then if it would be accepted, expose colorful logs to applications somehow.
I wasn't using application level logging recently, just `printf|s. Don't
know how it works now, but it should also be doable.

On Mon, 17 Aug 2020, 13:34 Christian Catchpole, <christ...@catchpole.net>
wrote:

> Thanks everyone.  There's obviously different levels of how far you take
> it. And not just colour, but simple things like "clear screen on NSH
> start", which I found useful for one use case at least.  Having commands
> colour aware as they are in linux is perhaps overkill at this stage. As a
> minimum I found coloring the prompt and then returning to regular print was
> a small but useful trick.
>
> As I'm new to NuttX and returning to serious C/systems development perhaps
> this is something I'll look into as a trial for getting to know Kconfig and
> the NuttX build system.
>
> Perhaps we could have a prompt color option in Kconfig which defaults to
> none.
> And clear screen on start which defaults to no.
>
> CC
>
> On Mon, 17 Aug 2020 at 21:24, Dave Marples <d...@marples.net> wrote:
>
> > Guys, chill, it was a joke :-) of course colour has utility for improved
> > cognition. Back in the day I remember discussions about if colour
> terminals
> > would ever take off cos folks couldn't see the point of them. That
> argument
> > got resolved.
> >
> > Colour certainly has utility. Small size does too. If we can accommodate
> > both (KConfig) then everyone is a winner.
> >
> > Dave
> >
> > On Mon, 17 Aug 2020, 07:50 Maciej W贸jcik, <w8j...@gmail.com> wrote:
> >
> > > I am confused a bit. Are you all guys talking about the same thing? If
> I
> > > understand correctly Christian just wanted to introduce colors to NSH.
> > >
> > > Colours in the terminal are not about looking good. Colours improve
> > > readability. The same text on the screen carries more information. This
> > is
> > > why everyone is using syntax highlighting in the editor when
> programming.
> > >
> > > It is easier to spot red error and yellow warning than just all black
> > text
> > > in terminal log. It would be great if there would be native option to
> > > enable this, without pdcurses.
> > >
> > >
> > > On Mon, 17 Aug 2020, 08:32 , <disruptivesolution...@gmail.com> wrote:
> > >
> > > > Please do not make technology about looks.... in functionality it has
> > to
> > > > work and be solid and has to address its purposes. If all is finished
> > and
> > > > value is there, one could bring a nice color too it 馃槈 Color is
> > throwing
> > > > money where functionality died....
> > > >
> > > > Ben
> > > >
> > > > -----Oorspronkelijk bericht-----
> > > > Van: Alan Carvalho de Assis <acas...@gmail.com>
> > > > Verzonden: zondag 16 augustus 2020 17:02
> > > > Aan: dev@nuttx.apache.org
> > > > Onderwerp: Re: Color ANSI support in nsh
> > > >
> > > > Christian,
> > > >
> > > > If I'm not wrong NuttX already has this feature to fancy interface if
> > you
> > > > use of pdcurses library.
> > > >
> > > > Greg added pdcurses some time ago and Ken Petit added support to use
> it
> > > > over telnet
> > > >
> > > > BR,
> > > >
> > > > Alan
> > > >
> > > > On 8/16/20, Christian Catchpole <christ...@catchpole.net> wrote:
> > > > > Yeah i should have had a poke around before posting on the group. I
> > > > > keep finding NuttX has so many features in the Kconfig :) I also
> > > > > suggested command history then found my Spresence NSH has history,
> so
> > > > > obviously i was not the first to think of it.
> > > > > I don't want to go TOO crazy with ANSI colours. I'll experiment
> with
> > a
> > > > > few things and then loop back around and see what others think.
> > > > >
> > > > > Thanks,
> > > > > Christian
> > > > >
> > > > >
> > > > > On Sun, 16 Aug 2020 at 22:11, Dave Marples <d...@marples.net>
> wrote:
> > > > >
> > > > >> Hiya,
> > > > >>
> > > > >> Yes, there's some cheesy simple stuff in there already (mainly to
> > > > >> stop the zephyr folks throwing shade cos their terminal is
> > prettier).
> > > > >> At the moment it only highlights commands, responses and errors
> > iirc,
> > > > >> but making it more context aware would certainly be nice....it's
> > > > >> already switched on/off by kconfig option.
> > > > >>
> > > > >> Regards
> > > > >>
> > > > >> Dave
> > > > >>
> > > > >> On Sun, 16 Aug 2020, 12:24 David Sidrane, <
> david.sidr...@nscdg.com>
> > > > >> wrote:
> > > > >>
> > > > >> > Hi Christian,
> > > > >> >
> > > > >> > As long as there is a Knob in Kconfig to enable / disable each
> > > > >> > feature (that defaults to disable) the impact is 0.
> > > > >> >
> > > > >> > IIRC there is a history, and some fancy-ness that was added by
> > Dave
> > > > >> > a
> > > > >> while
> > > > >> > ago. Good docs and an example defconfig would will keep it
> > > > >> > maintained
> > > > >> (and
> > > > >> > built). Once we have scripted test running against the sim (or
> > real
> > > > >> > HW) test cases will keep it from breaking.
> > > > >> >
> > > > >> > David
> > > > >> >
> > > > >> > -----Original Message-----
> > > > >> > From: Christian Catchpole [mailto:christ...@catchpole.net]
> > > > >> > Sent: Saturday, August 15, 2020 5:52 PM
> > > > >> > To: dev@nuttx.apache.org
> > > > >> > Subject: Color ANSI support in nsh
> > > > >> >
> > > > >> > Hi everyone,
> > > > >> >
> > > > >> > I have been adding ANSI escape codes for colour support to my
> > app鈥檚
> > > > >> console
> > > > >> > output and have been experimenting with adding it to nsh itself.
> > At
> > > > >> > a minimum to colour the prompt.
> > > > >> >
> > > > >> > I had been thinking this is something i could develop and
> propose
> > > > >> > to come back into the mainline as a nsh kconfig option.
> > > > >> >
> > > > >> > But before i do, the obvious question is, has this been proposed
> > > > >> > before
> > > > >> and
> > > > >> > are there reasons we wouldn鈥檛 want this in NuttX?
> > > > >> >
> > > > >> > I鈥檓 also thinking it would be good to have a single line of
> > command
> > > > >> > history. Other configurable options could be clear screen on nsh
> > > > >> > entry (I added this as my app was using ANSI line positioning
> and
> > > > >> > resets back into nsh looked messy). There are all sorts of fun
> > > > >> > things which could be done with ANSI terminal emulation.
> > > > >> >
> > > > >> > Thanks,
> > > > >> > See you all tonight. Where you鈥檒l see my demo going crazy with
> > ANSI
> > > > >> colour
> > > > >> > codes.
> > > > >> >
> > > > >> > Christian
> > > > >> >
> > > > >>
> > > > >
> > > >
> > > >
> > >
> >
>

Reply via email to