Skip to content

Commit

Permalink
Merge pull request #20 from tpiekarski/feature/walking-print-macro
Browse files Browse the repository at this point in the history
Adding walker macro, updating demo and README, resolves #7
  • Loading branch information
tpiekarski committed May 6, 2020
2 parents 62be4d5 + f38e8fe commit ab52416
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ inside the code and on the other one it should increase readability when running

pp_warn("Shortcut for severity level and flushing '\n' character");
pp_debug("Extended metadata while printk-ing with debug=1 or PP_DEBUG");
pp_walker();

// [...]
```
```sh
[ 8204.477771] pretty_printk_demo: "Shortcut for severity level and flushing '\n' character"
[ 8204.477773] pretty_printk_demo (pretty_printk_demo_init @ pretty_printk_demo.c, 62): "Extended metadata while printk-ing with debug=1 or PP_DEBUG"
[ 8204.477775] pretty_printk_demo (pretty_printk_demo_init @ pretty_printk_demo.c, 63): "It worked up to this line"
```

For testing, playing and looking at the features the repository provides a demo module *pretty_printk_demo* to
Expand Down
2 changes: 2 additions & 0 deletions pretty_printk.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@
##args)

#define pp_debug(args...) _pp_debug(args)
#define pp_walker() _pp_debug("It worked up to this line")
#else
#define pp_debug(...) // no debug output
#define pp_walker() // not walking code
#endif

#endif
1 change: 1 addition & 0 deletions pretty_printk_demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ static int __init pretty_printk_demo_init(void)
// Output for README.md
pp_warn("Shortcut for severity level and flushing '\n' character");
pp_debug("Extended metadata while printk-ing with debug=1 or PP_DEBUG");
pp_walker();

return 0;
}
Expand Down

0 comments on commit ab52416

Please sign in to comment.