From 78feebc5f3203d17365cf830ece6c86115eb2ec9 Mon Sep 17 00:00:00 2001 From: minhanghuang Date: Sat, 27 Jul 2024 12:05:25 +0800 Subject: [PATCH] feat: Added cyber log saved directory --- README.md | 20 +++++++++++++++----- setup.bash.in | 8 ++++++++ setup.zsh.in | 8 ++++++++ 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 977ed61..10a47da 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,11 @@ | Target | CI Status | | ------------- | :-----:| -| Ubuntu18.04 x86-64 | [![build v9.0.0](https://github.com/minhanghuang/CyberRT/actions/workflows/ubuntu18-v9.0.0-build.yaml/badge.svg?branch=v9.0.0)](https://github.com/minhanghuang/CyberRT/actions/workflows/ubuntu18-v9.0.0-build.yaml) | -| Ubuntu20.04 x86-64 | [![build v9.0.0](https://github.com/minhanghuang/CyberRT/actions/workflows/ubuntu20-v9.0.0-build.yaml/badge.svg?branch=v9.0.0)](https://github.com/minhanghuang/CyberRT/actions/workflows/ubuntu20-v9.0.0-build.yaml) | -| Ubuntu22.04 x86-64 | [![build v9.0.0](https://github.com/minhanghuang/CyberRT/actions/workflows/ubuntu22-v9.0.0-build.yaml/badge.svg?branch=v9.0.0)](https://github.com/minhanghuang/CyberRT/actions/workflows/ubuntu22-v9.0.0-build.yaml) | -| Ubuntu24.04 x86-64 | [![build v9.0.0](https://github.com/minhanghuang/CyberRT/actions/workflows/ubuntu24-v9.0.0-build.yaml/badge.svg?branch=v9.0.0)](https://github.com/minhanghuang/CyberRT/actions/workflows/ubuntu24-v9.0.0-build.yaml) | -| Ubuntu latest x86-64 | [![build v9.0.0](https://github.com/minhanghuang/CyberRT/actions/workflows/ubuntu-latest-v9.0.0-build.yaml/badge.svg?branch=v9.0.0)](https://github.com/minhanghuang/CyberRT/actions/workflows/ubuntu-latest-v9.0.0-build.yaml) | +| Ubuntu18.04 x86_64 | [![build v9.0.0](https://github.com/minhanghuang/CyberRT/actions/workflows/ubuntu18-v9.0.0-build.yaml/badge.svg?branch=v9.0.0)](https://github.com/minhanghuang/CyberRT/actions/workflows/ubuntu18-v9.0.0-build.yaml) | +| Ubuntu20.04 x86_64 | [![build v9.0.0](https://github.com/minhanghuang/CyberRT/actions/workflows/ubuntu20-v9.0.0-build.yaml/badge.svg?branch=v9.0.0)](https://github.com/minhanghuang/CyberRT/actions/workflows/ubuntu20-v9.0.0-build.yaml) | +| Ubuntu22.04 x86_64 | [![build v9.0.0](https://github.com/minhanghuang/CyberRT/actions/workflows/ubuntu22-v9.0.0-build.yaml/badge.svg?branch=v9.0.0)](https://github.com/minhanghuang/CyberRT/actions/workflows/ubuntu22-v9.0.0-build.yaml) | +| Ubuntu24.04 x86_64 | [![build v9.0.0](https://github.com/minhanghuang/CyberRT/actions/workflows/ubuntu24-v9.0.0-build.yaml/badge.svg?branch=v9.0.0)](https://github.com/minhanghuang/CyberRT/actions/workflows/ubuntu24-v9.0.0-build.yaml) | +| Ubuntu latest x86_64 | [![build v9.0.0](https://github.com/minhanghuang/CyberRT/actions/workflows/ubuntu-latest-v9.0.0-build.yaml/badge.svg?branch=v9.0.0)](https://github.com/minhanghuang/CyberRT/actions/workflows/ubuntu-latest-v9.0.0-build.yaml) | | Ubuntu18.04 arrch64 | [![build v9.0.0](https://github.com/minhanghuang/CyberRT/actions/workflows/ubuntu18-arrch64-v9.0.0-build.yaml/badge.svg?branch=v9.0.0)](https://github.com/minhanghuang/CyberRT/actions/workflows/ubuntu18-arrch64-v9.0.0-build.yaml) | | Ubuntu20.04 arrch64 | [![build v9.0.0](https://github.com/minhanghuang/CyberRT/actions/workflows/ubuntu20-arrch64-v9.0.0-build.yaml/badge.svg?branch=v9.0.0)](https://github.com/minhanghuang/CyberRT/actions/workflows/ubuntu20-arrch64-v9.0.0-build.yaml) | | Ubuntu22.04 arrch64 | [![build v9.0.0](https://github.com/minhanghuang/CyberRT/actions/workflows/ubuntu22-arrch64-v9.0.0-build.yaml/badge.svg?branch=v9.0.0)](https://github.com/minhanghuang/CyberRT/actions/workflows/ubuntu22-arrch64-v9.0.0-build.yaml) | @@ -82,6 +82,16 @@ cyber_launch start share/examples/common_component_example/common.launch ./cyber/examples/common_component_example/channel_test_writer ``` +3. log directory(optional) + +**The Cyber log storage path is similar to `ROS` and is saved in `~/.cyber/log`** + +If you want to modify the log storage path, you can change the `GLOG_log_dir` environment variable as follows: + +```shell +# export GLOG_log_dir=/path/to/cyber/log +``` + ## #4 Tools 1. channel diff --git a/setup.bash.in b/setup.bash.in index 5078550..4deded0 100644 --- a/setup.bash.in +++ b/setup.bash.in @@ -1,6 +1,7 @@ #!/usr/bin/bash _SETUP_PATH=$(cd `dirname $BASH_SOURCE[0]`; pwd) +USER_HOME_DIR=$(getent passwd $USER | cut -d: -f6) CYBERRT_PATH=$(dirname "$_SETUP_PATH") BUILD_PATH=$_SETUP_PATH @@ -34,6 +35,13 @@ for entry in "${mainboard_path}" \ export PATH="${entry}":$PATH done +# create log dir +CYBER_LOG_DIR_PREFIX="$USER_HOME_DIR/.cyber/log" +if [ ! -d "$CYBER_LOG_DIR_PREFIX" ]; then + mkdir -p "$CYBER_LOG_DIR_PREFIX" +fi + +export GLOG_log_dir="$CYBER_LOG_DIR_PREFIX" export GLOG_alsologtostderr=1 export GLOG_colorlogtostderr=1 export GLOG_minloglevel=0 diff --git a/setup.zsh.in b/setup.zsh.in index 710d38c..4631712 100644 --- a/setup.zsh.in +++ b/setup.zsh.in @@ -1,6 +1,7 @@ #!/usr/bin/bash _SETUP_PATH=$(cd `dirname $0`; pwd) +USER_HOME_DIR=$(getent passwd $USER | cut -d: -f6) CYBERRT_PATH=$(dirname "$_SETUP_PATH") # CyberRT Path BUILD_PATH=$_SETUP_PATH # build path @@ -35,6 +36,13 @@ for entry in "${mainboard_path}" \ export PATH="${entry}":$PATH done +# create log dir +CYBER_LOG_DIR_PREFIX="$USER_HOME_DIR/.cyber/log" +if [ ! -d "$CYBER_LOG_DIR_PREFIX" ]; then + mkdir -p "$CYBER_LOG_DIR_PREFIX" +fi + +export GLOG_log_dir="$CYBER_LOG_DIR_PREFIX" export GLOG_alsologtostderr=1 export GLOG_colorlogtostderr=1 export GLOG_minloglevel=0