Skip to content

Commit

Permalink
Merge pull request #6 from HannesBachter/feature/debug_mode
Browse files Browse the repository at this point in the history
add option to define logging level
  • Loading branch information
benmaidel committed Mar 26, 2024
2 parents 1dc261d + 1b55262 commit f15487a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ It is also helpful for local development to start multiple commands easily with

## Installation

Install the robmuxinator with one simple command
Install the robmuxinator with one simple command (execute in the `robmuxinator` package)
```
sudo pip install .
```
Expand Down Expand Up @@ -60,7 +60,7 @@ sessions:
host: localhost
prio: 1
command: echo 'starting bringup...'

```

To start the `tmux` sessions use `robmuxinator -c ~/path-to-file start`. Now, you are able to see your sessions with `tmux ls`
Expand Down Expand Up @@ -94,7 +94,7 @@ sessions:
host: h2
prio: 1
command: echo 'starting bringup...'

```
## Usage
### Command Choices
Expand Down
12 changes: 11 additions & 1 deletion robmuxinator/robmuxinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ def format(self, record):
logging.addLevelName(logging.CRITICAL, "C")

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)

custom_format = CustomFormatter()

Expand Down Expand Up @@ -750,13 +749,24 @@ def main():
action="store_true",
help="close sessions even if they are locked",
)
parser.add_argument(
"-l",
"--logging_level",
required=False,
choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
default="INFO",
help="logging level",
)

argcomplete.autocomplete(parser)
args = parser.parse_args()
# parse arguments
yaml_file = args.config
command = args.command

# set logging level
logger.setLevel(level=args.logging_level)

# load yaml file
with open(yaml_file, "r") as fs:
yaml_content = yaml.safe_load(fs)
Expand Down

0 comments on commit f15487a

Please sign in to comment.