Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate JSK_ROS_XXX log_utils #1461

Closed
wkentaro opened this issue Oct 21, 2016 · 2 comments

Comments

Projects
None yet
1 participant
@wkentaro
Copy link
Member

commented Oct 21, 2016

Actually, I found the JSK_ROS_XXX logging macros are not necessary just recently.
Its feature is already covered by ROSCONSOLE_FORMAT environmental variable.
http://wiki.ros.org/rosconsole#Console_Output_Formatting
(you can try it by running export ROSCONSOLE_FORMAT='[${node}] [${function}] [${severity}] [${time}]: ${message}')

Source: #1446 (comment)

wkentaro added a commit to wkentaro/jsk_common that referenced this issue Oct 21, 2016

wkentaro added a commit to wkentaro/jsk_common that referenced this issue Oct 26, 2016

wkentaro added a commit to wkentaro/jsk_recognition that referenced this issue Oct 26, 2016

@wkentaro

This comment has been minimized.

Copy link
Member Author

commented Oct 26, 2016

Migration Script

#!/usr/bin/env python

import os
import os.path as osp


for root, dirnames, filenames in os.walk('src'):
    if '/.git' in root:
        continue
    for fname in filenames:
        ext = osp.splitext(fname)[-1]
        cpp_extensions = ['.h', '.hpp', '.hxx', '.c', '.cpp', '.cxx']
        if ext not in cpp_extensions:
            continue

        fname = osp.realpath(osp.join(root, fname))
        print(fname)

        lines = []
        f = open(fname, 'r')
        for line in f.readlines():
            for prefix in ['JSK_ROS_', 'JSK_NODELET_']:
                for level in ['DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL']:
                    for suffix in ['', '_ONCE', '_THROTTLE', '_STREAM']:
                        pattern = prefix + level.upper() + suffix
                        repl = prefix[len('JSK_'):] + level.upper() + suffix
                        line = line.replace(pattern, repl)
            lines.append(line)
        f.close()

        with open(fname, 'w') as f:
            f.writelines(lines)
@wkentaro

This comment has been minimized.

Copy link
Member Author

commented Dec 2, 2016

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.