master
1// this script hooks into a player-provided utility to track the number of calls
2function(context, args) {
3
4 // we'll wrap the analytics in a try-catch, so that a failure during recording doesn't break the rest of the script
5 try {
6 // Basic usage. see dtr.man{page:"soron.arch_data"} for additional usage. Also, there's ada.haxfax floating around, which has a semi-compatible API.
7 #s.soron.arch_data({log:{c:context}});
8 } catch (e) {
9 // oh well, we can live with this. Congrats, user-who-is-not-tracked!
10 }
11
12
13 // I guess we should do something other than just record our usage, right? Ah, I know! Let's display our usage, and the usage of whatever script called us (if any).
14 return {
15 // the query:"foo.bar" version is also shown, formatted, on dtr.man pages.
16 my_usage: #s.soron.arch_data({query: context.this_script}),
17 calling_usage: #s.soron.arch_data({query: context.calling_script}),
18 // these next two are formatted better when called on the command line. Try them there! soron.arch_data{rankings:"cli"}, for example
19 global_cli_usage: #s.soron.arch_data({rankings:"cli"}),
20 global_lib_usage: #s.soron.arch_data({rankings:"lib"}),
21 }
22}