question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow configuring (vs just toggling) v1's output line prefix

See original GitHub issue

Description

It seems that the output prefix should be a bit more flexible than it currently is. The current format is:

[hoststring] Message

This should be flexible, meaning both format as well as the ability to turn it off, or make it print one line per host/task combo. (That particular aspect has been spun off into #281.)

An ideal situation would be to use python’s built-in template strings. (or to be very forward thinking format strings, but those require 2.6). The template can be put in evn.output.prefix or similar. Using the templates it is easy to just define output format based on exposed variables.

These could include:

  • hostname
  • hoststring
  • comand output signifier [1][2]
  • time [1]
  • other stuff

It could also include color code formatting.

[1] some variables will need to have a helper variable, e.g. strftime format for time [2] output signifier could be something simple like a ** making the output something like:

[hostname] Log msg
[hostname] ** output from cmd

An example format string (with helpers) could look like:

env.output.prefix = "[${hostname} - ${time}] ${cmd_sig}"
env.output.timeformat = "H:M"
env.output.cmd_sig = "**"

resulting in:

[www1.foo.com - 17:05] Executing hostname
[www1.foo.com - 17:05] ** www1.foo.com

Originally submitted by Erich Heine (sophacles) on 2010-05-14 at 05:56pm EDT

Attachments

Relations

  • Related to #164: puts show_prefix
  • Related to #281: Make line prefix optional
  • Related to #57: Support full logging to file
  • Related to #7: Improved prompt detection and passthrough

Issue Analytics

  • State:open
  • Created 12 years ago
  • Reactions:2
  • Comments:21 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
humitoscommented, Apr 1, 2014

It would be good to have the ability to turn the prefix off also. For example, I’m using this task to connect to a remote Django shell and try many things on the server directly:

def shell_plus():
    with cd(env.project):
        with virtualenv(env.venv):
            run("./manage.py shell")

Right now, I have a lot of prefix information that I don’t need and it’s just noise.

0reactions
bitprophetcommented, Jul 16, 2018

On second thought, just make it more obvious that this would be a nice small feature add for the 1.x line.

Read more comments on GitHub >

github_iconTop Results From Across the Web

January 2022 (version 1.64) - Visual Studio Code
allowedLocales can be used to allow characters that are common in one or many configured locales. By default, this includes the current VS...
Read more >
VS Code Gets New Side Panel in v1.64 Update
Settings editor search -- Search now prioritizes whole word matches: The Settings editor search now looks for string value matches in string and ......
Read more >
Configuration options | Yarn - Package Manager
List of all the configuration option for Yarn (yarnrc files) ... To do this, just prefix the names and write them in snake...
Read more >
config | npm Docs
Putting --foo bar on the command line sets the foo configuration parameter to "bar" . ... Do not show any source or destination...
Read more >
Getting Started with AppCmd.exe | Microsoft Learn
AppCmd.exe is the single command line tool for managing IIS 7 and above. ... a backup before changing server configuration, or installing a ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found