@@ -42,7 +42,7 @@ Licensed under EPL (http://www.eclipse.org/legal/epl-v10.html)"
42
42
(:require
43
43
[clj-ssh.keychain :as keychain]
44
44
[clojure.contrib.condition :as condition]
45
- [clojure.contrib .logging :as logging]
45
+ [clojure.tools .logging :as logging]
46
46
[clojure.contrib.reflect :as reflect]
47
47
[clojure.java.io :as io]
48
48
[clojure.string :as string])
@@ -70,7 +70,7 @@ Licensed under EPL (http://www.eclipse.org/legal/epl-v10.html)"
70
70
(>= level log-level))
71
71
(log
72
72
[_ level message]
73
- (logging/log (@ssh-log-levels level) message nil " clj-ssh.ssh " )))
73
+ (logging/log " clj-ssh.ssh " (@ssh-log-levels level) nil message )))
74
74
75
75
(JSch/setLogger (SshLogger. com.jcraft.jsch.Logger/DEBUG))
76
76
@@ -123,8 +123,7 @@ Licensed under EPL (http://www.eclipse.org/legal/epl-v10.html)"
123
123
([private-key-path public-key-path]
124
124
(make-identity *ssh-agent* private-key-path public-key-path))
125
125
([^JSch agent ^String private-key-path ^String public-key-path]
126
- (logging/trace
127
- (format " Make identity %s %s" private-key-path public-key-path))
126
+ (logging/tracef " Make identity %s %s" private-key-path public-key-path)
128
127
(reflect/call-method
129
128
com.jcraft.jsch.IdentityFile 'newInstance [String String JSch]
130
129
nil private-key-path public-key-path agent)))
@@ -413,8 +412,8 @@ cmd specifies a command to exec. If no cmd is given, a shell is started and inp
413
412
Options are
414
413
415
414
:in specifies input to the remote shell. A string or a stream.
416
- :out specify :stream to obtain a an [inputstream shell],
417
- specify :bytes to obtain a byte array,
415
+ :out specify :stream to obtain a an [inputstream shell]
416
+ specify :bytes to obtain a byte array
418
417
or specify a string with an encoding specification for a
419
418
result string. In the case of :stream, the shell can
420
419
be polled for connected status.
@@ -613,7 +612,7 @@ Options are
613
612
[out in cmd-string]
614
613
(.write out (.getBytes cmd-string))
615
614
(.flush out)
616
- (logging/trace ( format " Sent command %s" cmd-string) )
615
+ (logging/tracef " Sent command %s" cmd-string)
617
616
(scp-receive-ack in)
618
617
(logging/trace " Received ACK" ))
619
618
@@ -624,14 +623,13 @@ Options are
624
623
buffer (byte-array buffer-size)]
625
624
(let [cmd (loop [offset 0 ]
626
625
(let [n (.read in buffer offset (- buffer-size offset))]
627
- (logging/trace
628
- (format
629
- " scp-receive-command: %s"
630
- (String. buffer 0 (+ offset n))))
626
+ (logging/tracef
627
+ " scp-receive-command: %s"
628
+ (String. buffer 0 (+ offset n)))
631
629
(if (= \newline (char (aget buffer (+ offset n -1 ))))
632
630
(String. buffer 0 (+ offset n))
633
631
(recur (+ offset n)))))]
634
- (logging/trace ( format " Received command %s" cmd) )
632
+ (logging/tracef " Received command %s" cmd)
635
633
(scp-send-ack out)
636
634
(logging/trace " Sent ACK" )
637
635
cmd)))
@@ -640,7 +638,7 @@ Options are
640
638
" Send acknowledgement to the specified output stream"
641
639
[send recv file {:keys [mode buffer-size preserve]
642
640
:or {mode 0644 buffer-size 1492 preserve false }}]
643
- (logging/trace ( format " Sending %s" (.getAbsolutePath file) ))
641
+ (logging/tracef " Sending %s" (.getAbsolutePath file))
644
642
(when preserve
645
643
(scp-send-command
646
644
send recv
@@ -658,7 +656,7 @@ Options are
658
656
(defn- scp-copy-dir
659
657
" Send acknowledgement to the specified output stream"
660
658
[send recv dir {:keys [dir-mode] :or {dir-mode 0755 } :as options}]
661
- (logging/trace ( format " Sending directory %s" (.getAbsolutePath dir) ))
659
+ (logging/trace " Sending directory %s" (.getAbsolutePath dir))
662
660
(scp-send-command
663
661
send recv
664
662
(format " D%04o 0 %s" dir-mode (.getName dir)))
@@ -721,7 +719,7 @@ Options are
721
719
(defn scp-sink-file
722
720
" Sink a file"
723
721
[send recv file mode length {:keys [buffer-size] :or {buffer-size 2048 }}]
724
- (logging/trace ( format " Sinking %d bytes to file %s" length (.getPath file) ))
722
+ (logging/tracef " Sinking %d bytes to file %s" length (.getPath file))
725
723
(let [buffer (byte-array buffer-size)]
726
724
(with-open [file-stream (java.io.FileOutputStream. file)]
727
725
(loop [length length]
@@ -792,14 +790,14 @@ Options are
792
790
(connect session))
793
791
(let [[in send] (streams-for-in )
794
792
cmd (format " scp %s -t %s" (:remote-flags opts " " ) remote-path)
795
- _ (logging/trace ( format " scp-to: %s" cmd) )
793
+ _ (logging/tracef " scp-to: %s" cmd)
796
794
[exec recv] (ssh-exec session cmd in :stream opts)]
797
- (logging/trace
798
- ( format " scp-to %s %s" (string/join " " local-paths) remote-path) )
795
+ (logging/tracef
796
+ " scp-to %s %s" (string/join " " local-paths) remote-path)
799
797
(logging/trace " Receive initial ACK" )
800
798
(scp-receive-ack recv)
801
799
(doseq [file files]
802
- (logging/trace ( format " scp-to: from %s" (.getPath file) ))
800
+ (logging/tracef " scp-to: from %s" (.getPath file))
803
801
(if (.isDirectory file)
804
802
(scp-copy-dir send recv file opts)
805
803
(scp-copy-file send recv file opts)))
@@ -864,10 +862,10 @@ Options are
864
862
(filter val)
865
863
(map (fn [k v] (k flags))))))
866
864
(string/join " " remote-paths))
867
- _ (logging/trace ( format " scp-from: %s" cmd) )
865
+ _ (logging/tracef " scp-from: %s" cmd)
868
866
[exec recv] (ssh-exec session cmd in :stream opts)]
869
- (logging/trace
870
- ( format " scp-from %s %s" (string/join " " remote-paths) local-path) )
867
+ (logging/tracef
868
+ " scp-from %s %s" (string/join " " remote-paths) local-path)
871
869
(scp-send-ack send)
872
870
(logging/trace " Sent initial ACK" )
873
871
(scp-sink send recv file nil opts)
0 commit comments