diff options
| author | chrislu <chris.lu@gmail.com> | 2025-05-22 09:54:31 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2025-05-22 09:54:31 -0700 |
| commit | 0d62be44846354c3c37b857028297edd4b8df17b (patch) | |
| tree | c89320a7d58351030f1b740c7267f56bf0206429 /replace_glog_calls.sh | |
| parent | d8c574a5ef1a811f9a0d447097d9edfcc0c1d84c (diff) | |
| download | seaweedfs-origin/changing-to-zap.tar.xz seaweedfs-origin/changing-to-zap.zip | |
Diffstat (limited to 'replace_glog_calls.sh')
| -rwxr-xr-x | replace_glog_calls.sh | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/replace_glog_calls.sh b/replace_glog_calls.sh new file mode 100755 index 000000000..5f73110ce --- /dev/null +++ b/replace_glog_calls.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Find all Go files containing glog.V calls +files=$(grep -l "glog.V" --include="*.go" -r .) + +# Check if any files were found +if [ -z "$files" ]; then + echo "No files found containing glog.V calls" + exit 0 +fi + +# Print the files that will be modified +echo "The following files will be modified:" +echo "$files" +echo + +# Ask for confirmation +read -p "Do you want to proceed with the replacement? (y/n) " -n 1 -r +echo +if [[ ! $REPLY =~ ^[Yy]$ ]]; then + echo "Operation cancelled" + exit 1 +fi + +# Make the replacements +for file in $files; do + echo "Processing $file" + # Replace glog.V(n).Info with log.V(n).Info for n=0-4 + for level in {0..4}; do + # Replace Info calls + sed -i '' "s/glog.V($level).Info/log.V($level).Info/g" "$file" + # Replace Infof calls + sed -i '' "s/glog.V($level).Infof/log.V($level).Infof/g" "$file" + done +done + +echo "Replacement complete!"
\ No newline at end of file |
