remove debug logging

This commit is contained in:
Jeffrey C. Ollie 2024-01-13 00:00:17 -06:00
parent 4b2e5b33b6
commit e7d5a97f81
Signed by: jeff
GPG key ID: 6F86035A6D97044E
2 changed files with 13 additions and 29 deletions

View file

@ -56,16 +56,16 @@ pub fn connect(
var path: []const u8 = undefined; var path: []const u8 = undefined;
var args = std.ArrayList([]const u8).init(alloc); var args = std.ArrayList([]const u8).init(alloc);
std.log.info("name: {s}", .{config.name}); // std.log.info("name: {s}", .{config.name});
std.log.info("class {s}", .{config.class}); // std.log.info("class {s}", .{config.class});
std.log.info("type: {}", .{config.type}); // std.log.info("type: {}", .{config.type});
std.log.info("comment: {s}", .{config.comment}); // std.log.info("comment: {s}", .{config.comment});
std.log.info("address: {s}", .{config.address}); // std.log.info("address: {s}", .{config.address});
std.log.info("port: {d}", .{config.port}); // std.log.info("port: {d}", .{config.port});
std.log.info("username: {s}", .{config.username}); // std.log.info("username: {s}", .{config.username});
std.log.info("manufacturer: {s}", .{config.manufacturer}); // std.log.info("manufacturer: {s}", .{config.manufacturer});
std.log.info("model: {s}", .{config.model}); // std.log.info("model: {s}", .{config.model});
std.log.info("part number: {s}", .{config.part_number}); // std.log.info("part number: {s}", .{config.part_number});
switch (config.type) { switch (config.type) {
.ssh => { .ssh => {
@ -134,9 +134,9 @@ pub fn connect(
const argsZ = try alloc.allocSentinel(?[*:0]const u8, args.items.len, null); const argsZ = try alloc.allocSentinel(?[*:0]const u8, args.items.len, null);
for (args.items, 0..) |arg, i| argsZ[i] = (try alloc.dupeZ(u8, arg)).ptr; for (args.items, 0..) |arg, i| argsZ[i] = (try alloc.dupeZ(u8, arg)).ptr;
for (argsZ, 0..) |arg, i| { // for (argsZ, 0..) |arg, i| {
if (arg) |a| std.log.info("{d} {s}", .{ i, a }); // if (arg) |a| std.log.info("{d} {s}", .{ i, a });
} // }
if (builtin.output_mode == .Exe) { if (builtin.output_mode == .Exe) {
const stdout_file = std.io.getStdOut().writer(); const stdout_file = std.io.getStdOut().writer();

View file

@ -48,11 +48,6 @@ pub fn main() !void {
} }
if (matches.subcommandMatches("connect")) |connect_matches| { if (matches.subcommandMatches("connect")) |connect_matches| {
// if (!(connect_matches.containsArgs())) {
// try app.displaySubcommandHelp();
// return;
// }
var it = connect_matches.args.keyIterator(); var it = connect_matches.args.keyIterator();
while (it.next()) |key| { while (it.next()) |key| {
logz.info().string("key", key.*).log(); logz.info().string("key", key.*).log();
@ -72,10 +67,7 @@ pub fn main() !void {
break :id null; break :id null;
}; };
std.log.info("id: {any}", .{identities});
if (identities) |i| { if (identities) |i| {
logz.info().string("test", "test").log();
for (i) |identity| { for (i) |identity| {
logz.info().string("identity", identity).log(); logz.info().string("identity", identity).log();
const fullpath = fp: { const fullpath = fp: {
@ -98,8 +90,6 @@ pub fn main() !void {
}; };
if (identity.ptr != fullpath.ptr) alloc.free(fullpath); if (identity.ptr != fullpath.ptr) alloc.free(fullpath);
} }
} else {
logz.warn().string("message", "no identities").log();
} }
const proxy_jump = connect_matches.getSingleValue("proxy-jump"); const proxy_jump = connect_matches.getSingleValue("proxy-jump");
@ -113,7 +103,6 @@ pub fn main() !void {
}; };
if (expanded) |v| { if (expanded) |v| {
ssh_path = v; ssh_path = v;
// defer alloc.free(ssh_path);
} }
} }
@ -126,14 +115,10 @@ pub fn main() !void {
break :expanded null; break :expanded null;
}; };
if (expanded) |v| { if (expanded) |v| {
std.log.info("expanded telnet path: {s}", .{v});
telnet_path = v; telnet_path = v;
// defer alloc.free(telnet_path);
} }
} }
std.log.info("ssh path: {s}", .{ssh_path});
std.log.info("telnet path: {s}", .{telnet_path});
try connect.connect(alloc, config_path, identities, proxy_jump, ssh_path, telnet_path); try connect.connect(alloc, config_path, identities, proxy_jump, ssh_path, telnet_path);
return; return;
@ -164,7 +149,6 @@ fn expandPath(alloc: std.mem.Allocator, cmd: []const u8) !?[]u8 {
path_buf[path_len] = 0; path_buf[path_len] = 0;
const full_path = path_buf[0..path_len :0]; const full_path = path_buf[0..path_len :0];
std.log.debug("path {s}", .{full_path});
const stat = std.fs.cwd().statFile(full_path) catch |err| switch (err) { const stat = std.fs.cwd().statFile(full_path) catch |err| switch (err) {
error.FileNotFound => continue, error.FileNotFound => continue,
error.AccessDenied => { error.AccessDenied => {