How to write a stop function in tfocs?

Dear Sir,

I’m using TFCOS to solve composite function problem.
I want to set the stopping criterion as norm(‘composite gradient’,‘inf’) < \epsilon.
For example,
l1_pen = prox_l1(lambda);
f_obj = @(x) logreg(X,y, x,alpha);% logistic regression
stop= @ (f,x) tfocs_stop(x, l1_pen, L, stop_val);
opt= struct(…
‘alg’ , ‘N07’, …
‘stopCrit’, Inf,…
‘stop_val’, stop_val,…
‘printStopCrit’, 1, …
‘stopFcn’, stop …
);
[ x_nes, tfcos_out] = tfocs( f_obj, [], l1_pen, x(:,1),opt);

How to define such a tfocs_stop function?

Thanks!