Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
3e5fa98a
Commit
3e5fa98a
authored
13 years ago
by
mcmlxxix
Browse files
Options
Downloads
Patches
Plain Diff
open file in binary mode :|
/T parameter to list column totals /R parameter to reverse listing
parent
ba18d4c0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/slog.js
+88
-55
88 additions, 55 deletions
exec/slog.js
with
88 additions
and
55 deletions
exec/slog.js
+
88
−
55
View file @
3e5fa98a
writeln
(
"
\r\n
Synchronet System/Node Statistics Log Viewer v1.02
\n
"
);
(
function
()
{
writeln
(
"
\r\n
Synchronet System/Node Statistics Log Viewer v1.02
\n
"
);
var
reverse
=
false
;
var
pause
=
false
;
var
sfile
=
new
File
(
system
.
ctrl_dir
+
"
csts.dab
"
);
var
list
=
[];
while
(
argv
.
length
>
0
)
{
var
reverse
=
false
;
switch
(
argv
.
shift
().
toUpperCase
())
{
var
show_totals
=
false
;
case
"
/REVERSE
"
:
case
"
/R
"
:
var
total_logons
=
0
;
reverse
=
true
;
var
total_timeon
=
0
;
break
;
var
total_uls
=
0
;
case
"
/PAUSE
"
:
var
total_ulb
=
0
;
case
"
/P
"
:
var
total_dls
=
0
;
pause
=
true
;
var
total_dlb
=
0
;
break
;
var
total_posts
=
0
;
var
total_emails
=
0
;
var
total_fbacks
=
0
;
while
(
argv
.
length
>
0
)
{
switch
(
argv
.
shift
().
toUpperCase
())
{
case
"
/REVERSE
"
:
case
"
/R
"
:
reverse
=
true
;
break
;
case
"
/TOTALS
"
:
case
"
/T
"
:
show_totals
=
true
;
break
;
}
}
}
}
if
(
!
file_exists
(
sfile
.
name
))
throw
(
sfile
.
name
+
"
does not exist
"
);
var
sfile
=
new
File
(
system
.
ctrl_dir
+
"
csts.dab
"
);
if
(
!
sfile
.
open
(
'
r+b
'
))
var
list
=
[];
throw
(
"
error opening
"
+
sfile
.
name
);
if
(
!
file_exists
(
sfile
.
name
))
while
(
sfile
.
position
<=
file_size
(
sfile
.
name
)
-
40
)
{
throw
(
sfile
.
name
+
"
does not exist
"
);
if
(
!
sfile
.
open
(
'
r+
'
))
var
timestamp
=
sfile
.
readBin
();
throw
(
"
error opening
"
+
sfile
.
name
);
var
logons
=
sfile
.
readBin
();
var
timeon
=
sfile
.
readBin
();
while
(
sfile
.
position
<=
file_size
(
sfile
.
name
)
-
40
)
{
var
uls
=
sfile
.
readBin
();
var
ulb
=
sfile
.
readBin
();
timestamp
=
sfile
.
readBin
();
var
dls
=
sfile
.
readBin
();
logons
=
sfile
.
readBin
();
var
dlb
=
sfile
.
readBin
();
timeon
=
sfile
.
readBin
();
var
posts
=
sfile
.
readBin
();
uls
=
sfile
.
readBin
();
var
emails
=
sfile
.
readBin
();
ulb
=
sfile
.
readBin
();
var
fbacks
=
sfile
.
readBin
();
dls
=
sfile
.
readBin
();
dlb
=
sfile
.
readBin
();
if
(
show_totals
)
{
posts
=
sfile
.
readBin
();
total_logons
+=
logons
;
emails
=
sfile
.
readBin
();
total_timeon
+=
timeon
;
fbacks
=
sfile
.
readBin
();
total_uls
+=
uls
;
total_ulb
+=
uls
;
yesterday
=
timestamp
-
(
24
*
60
*
60
);
/* 1 day less than stamp */
total_dls
+=
uls
;
total_dlb
+=
uls
;
list
.
unshift
(
total_posts
+=
posts
;
strftime
(
"
%x
"
,
yesterday
)
+
total_emails
+=
emails
;
format
(
"
T:%5lu L:%3lu P:%3lu E:%3lu F:%3lu U:%6luk %3lu D:%6luk %3lu
"
,
total_fbacks
+=
fbacks
;
timeon
,
logons
,
posts
,
emails
,
fbacks
,
ulb
/
1024
,
uls
,
dlb
/
1024
,
dls
)
}
);
}
list
.
unshift
(
strftime
(
"
%x
"
,
timestamp
-
(
24
*
60
*
60
))
+
if
(
reverse
)
format
(
"
T:%5lu L:%3lu P:%3lu E:%3lu F:%3lu U:%6luk %3lu D:%6luk %3lu
"
,
list
.
reverse
();
timeon
,
logons
,
posts
,
emails
,
fbacks
,
ulb
/
1024
,
uls
,
dlb
/
1024
,
dls
)
);
for
each
(
var
i
in
list
)
}
print
(
i
);
sfile
.
close
();
sfile
.
close
();
if
(
reverse
)
list
.
reverse
();
for
each
(
var
i
in
list
)
writeln
(
i
);
if
(
show_totals
)
{
writeln
(
""
);
writeln
(
format
(
"
%-*s: %d
"
,
20
,
"
Total Time
"
,
total_timeon
));
writeln
(
format
(
"
%-*s: %d
"
,
20
,
"
Total Logons
"
,
total_logons
));
writeln
(
format
(
"
%-*s: %d - %dk
"
,
20
,
"
Total U/L
"
,
total_uls
,
total_ulb
));
writeln
(
format
(
"
%-*s: %d - %dk
"
,
20
,
"
Total D/L
"
,
total_dls
,
total_dlb
));
writeln
(
format
(
"
%-*s: %d
"
,
20
,
"
Total Posts
"
,
total_posts
));
writeln
(
format
(
"
%-*s: %d
"
,
20
,
"
Total E-Mails
"
,
total_emails
));
writeln
(
format
(
"
%-*s: %d
"
,
20
,
"
Total Feedback
"
,
total_fbacks
));
}
writeln
(
""
);
})();
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment