Skip to content

Commit

Permalink
Log to stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
andy1li committed Oct 27, 2024
1 parent f2c39ae commit 8074ad1
Show file tree
Hide file tree
Showing 30 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion compiled_starters/cpp/src/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ int main(int argc, char* argv[]) {
std::cerr << std::unitbuf;

// You can use print statements as follows for debugging, they'll be visible when running tests.
std::cout << "Logs from your program will appear here" << std::endl;
std::cerr << "Logs from your program will appear here" << std::endl;

if (argc != 3) {
std::cerr << "Expected two arguments" << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion compiled_starters/csharp/src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ static bool MatchPattern(string inputLine, string pattern)
string inputLine = Console.In.ReadToEnd();

// You can use print statements as follows for debugging, they'll be visible when running tests.
Console.WriteLine("Logs from your program will appear here!");
Console.Error.WriteLine("Logs from your program will appear here!");

// Uncomment this block to pass the first stage
//
Expand Down
2 changes: 1 addition & 1 deletion compiled_starters/gleam/src/main.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import gleam/string

pub fn main() {
// You can use print statements as follows for debugging, they'll be visible when running tests.
io.println("Logs from your program will appear here!")
io.print_error("Logs from your program will appear here!")

let args = argv.load().arguments
let assert Ok(input_line) = erlang.get_line("")
Expand Down
2 changes: 1 addition & 1 deletion compiled_starters/go/cmd/mygrep/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func matchLine(line []byte, pattern string) (bool, error) {
var ok bool

// You can use print statements as follows for debugging, they'll be visible when running tests.
fmt.Println("Logs from your program will appear here!")
fmt.Fprintln(os.Stderr, "Logs from your program will appear here!")

// Uncomment this to pass the first stage
// ok = bytes.ContainsAny(line, pattern)
Expand Down
2 changes: 1 addition & 1 deletion compiled_starters/haskell/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ main = do
input_line <- getLine

-- You can use print statements as follows for debugging, they'll be visible when running tests.
putStrLn "Logs from your program will appear here"
hPutStrLn stderr "Logs from your program will appear here"

-- Uncomment this block to pass stage 1
-- if head args /= "-E"
Expand Down
2 changes: 1 addition & 1 deletion compiled_starters/javascript/app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function main() {
}

// You can use print statements as follows for debugging, they'll be visible when running tests.
console.log("Logs from your program will appear here");
console.error("Logs from your program will appear here");

// Uncomment this block to pass the first stage
// if (matchPattern(inputLine, pattern)) {
Expand Down
2 changes: 1 addition & 1 deletion compiled_starters/python/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def main():
exit(1)

# You can use print statements as follows for debugging, they'll be visible when running tests.
print("Logs from your program will appear here!")
print("Logs from your program will appear here!", file=sys.stderr)

# Uncomment this block to pass the first stage
# if match_pattern(input_line, pattern):
Expand Down
2 changes: 1 addition & 1 deletion compiled_starters/ruby/app/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def main
end

# You can use print statements as follows for debugging, they'll be visible when running tests.
puts "Logs from your program will appear here"
warn "Logs from your program will appear here"

# Uncomment this block to pass the first stage
# if match_pattern(input_line, pattern)
Expand Down
2 changes: 1 addition & 1 deletion compiled_starters/rust/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fn match_pattern(input_line: &str, pattern: &str) -> bool {
// Usage: echo <input_text> | your_program.sh -E <pattern>
fn main() {
// You can use print statements as follows for debugging, they'll be visible when running tests.
println!("Logs from your program will appear here!");
eprintln!("Logs from your program will appear here!");

if env::args().nth(1).unwrap() != "-E" {
println!("Expected first argument to be '-E'");
Expand Down
2 changes: 1 addition & 1 deletion compiled_starters/typescript/app/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (args[2] !== "-E") {
}

// You can use print statements as follows for debugging, they'll be visible when running tests.
console.log("Logs from your program will appear here!");
console.error("Logs from your program will appear here!");

// Uncomment this block to pass the first stage
// if (matchPattern(inputLine, pattern)) {
Expand Down
2 changes: 1 addition & 1 deletion solutions/cpp/01-cq2/diff/src/Server.cpp.diff
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
std::cerr << std::unitbuf;

- // You can use print statements as follows for debugging, they'll be visible when running tests.
- std::cout << "Logs from your program will appear here" << std::endl;
- std::cerr << "Logs from your program will appear here" << std::endl;
-
if (argc != 3) {
std::cerr << "Expected two arguments" << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion solutions/csharp/01-cq2/diff/src/Program.cs.diff
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
string inputLine = Console.In.ReadToEnd();

-// You can use print statements as follows for debugging, they'll be visible when running tests.
-Console.WriteLine("Logs from your program will appear here!");
-Console.Error.WriteLine("Logs from your program will appear here!");
-
-// Uncomment this block to pass the first stage
-//
Expand Down
2 changes: 1 addition & 1 deletion solutions/gleam/01-cq2/diff/src/main.gleam.diff
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

pub fn main() {
- // You can use print statements as follows for debugging, they'll be visible when running tests.
- io.println("Logs from your program will appear here!")
- io.print_error("Logs from your program will appear here!")
-
let args = argv.load().arguments
let assert Ok(input_line) = erlang.get_line("")
Expand Down
2 changes: 1 addition & 1 deletion solutions/go/01-cq2/diff/cmd/mygrep/main.go.diff
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
var ok bool

- // You can use print statements as follows for debugging, they'll be visible when running tests.
- fmt.Println("Logs from your program will appear here!")
- fmt.Fprintln(os.Stderr, "Logs from your program will appear here!")
-
- // Uncomment this to pass the first stage
- // ok = bytes.ContainsAny(line, pattern)
Expand Down
2 changes: 1 addition & 1 deletion solutions/haskell/01-cq2/diff/app/Main.hs.diff
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
input_line <- getLine

- -- You can use print statements as follows for debugging, they'll be visible when running tests.
- putStrLn "Logs from your program will appear here"
- hPutStrLn stderr "Logs from your program will appear here"
-
- -- Uncomment this block to pass stage 1
- -- if head args /= "-E"
Expand Down
2 changes: 1 addition & 1 deletion solutions/javascript/01-cq2/diff/app/main.js.diff
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}

- // You can use print statements as follows for debugging, they'll be visible when running tests.
- console.log("Logs from your program will appear here");
- console.error("Logs from your program will appear here");
-
- // Uncomment this block to pass the first stage
- // if (matchPattern(inputLine, pattern)) {
Expand Down
2 changes: 1 addition & 1 deletion solutions/python/01-cq2/diff/app/main.py.diff
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
exit(1)

- # You can use print statements as follows for debugging, they'll be visible when running tests.
- print("Logs from your program will appear here!")
- print("Logs from your program will appear here!", file=sys.stderr)
-
- # Uncomment this block to pass the first stage
- # if match_pattern(input_line, pattern):
Expand Down
2 changes: 1 addition & 1 deletion solutions/ruby/01-cq2/diff/app/main.rb.diff
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
end

- # You can use print statements as follows for debugging, they'll be visible when running tests.
- puts "Logs from your program will appear here"
- warn "Logs from your program will appear here"
-
- # Uncomment this block to pass the first stage
- # if match_pattern(input_line, pattern)
Expand Down
2 changes: 1 addition & 1 deletion solutions/rust/01-cq2/diff/src/main.rs.diff
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// Usage: echo <input_text> | your_program.sh -E <pattern>
fn main() {
- // You can use print statements as follows for debugging, they'll be visible when running tests.
- println!("Logs from your program will appear here!");
- eprintln!("Logs from your program will appear here!");
-
if env::args().nth(1).unwrap() != "-E" {
println!("Expected first argument to be '-E'");
Expand Down
2 changes: 1 addition & 1 deletion solutions/typescript/01-cq2/diff/app/main.ts.diff
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
}

-// You can use print statements as follows for debugging, they'll be visible when running tests.
-console.log("Logs from your program will appear here!");
-console.error("Logs from your program will appear here!");
-
-// Uncomment this block to pass the first stage
-// if (matchPattern(inputLine, pattern)) {
Expand Down
2 changes: 1 addition & 1 deletion starter_templates/cpp/code/src/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ int main(int argc, char* argv[]) {
std::cerr << std::unitbuf;

// You can use print statements as follows for debugging, they'll be visible when running tests.
std::cout << "Logs from your program will appear here" << std::endl;
std::cerr << "Logs from your program will appear here" << std::endl;

if (argc != 3) {
std::cerr << "Expected two arguments" << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion starter_templates/csharp/code/src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ static bool MatchPattern(string inputLine, string pattern)
string inputLine = Console.In.ReadToEnd();

// You can use print statements as follows for debugging, they'll be visible when running tests.
Console.WriteLine("Logs from your program will appear here!");
Console.Error.WriteLine("Logs from your program will appear here!");

// Uncomment this block to pass the first stage
//
Expand Down
2 changes: 1 addition & 1 deletion starter_templates/gleam/code/src/main.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import gleam/string

pub fn main() {
// You can use print statements as follows for debugging, they'll be visible when running tests.
io.println("Logs from your program will appear here!")
io.print_error("Logs from your program will appear here!")

let args = argv.load().arguments
let assert Ok(input_line) = erlang.get_line("")
Expand Down
2 changes: 1 addition & 1 deletion starter_templates/go/code/cmd/mygrep/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func matchLine(line []byte, pattern string) (bool, error) {
var ok bool

// You can use print statements as follows for debugging, they'll be visible when running tests.
fmt.Println("Logs from your program will appear here!")
fmt.Fprintln(os.Stderr, "Logs from your program will appear here!")

// Uncomment this to pass the first stage
// ok = bytes.ContainsAny(line, pattern)
Expand Down
2 changes: 1 addition & 1 deletion starter_templates/haskell/code/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ main = do
input_line <- getLine

-- You can use print statements as follows for debugging, they'll be visible when running tests.
putStrLn "Logs from your program will appear here"
hPutStrLn stderr "Logs from your program will appear here"

-- Uncomment this block to pass stage 1
-- if head args /= "-E"
Expand Down
2 changes: 1 addition & 1 deletion starter_templates/javascript/code/app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function main() {
}

// You can use print statements as follows for debugging, they'll be visible when running tests.
console.log("Logs from your program will appear here");
console.error("Logs from your program will appear here");

// Uncomment this block to pass the first stage
// if (matchPattern(inputLine, pattern)) {
Expand Down
2 changes: 1 addition & 1 deletion starter_templates/python/code/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def main():
exit(1)

# You can use print statements as follows for debugging, they'll be visible when running tests.
print("Logs from your program will appear here!")
print("Logs from your program will appear here!", file=sys.stderr)

# Uncomment this block to pass the first stage
# if match_pattern(input_line, pattern):
Expand Down
2 changes: 1 addition & 1 deletion starter_templates/ruby/code/app/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def main
end

# You can use print statements as follows for debugging, they'll be visible when running tests.
puts "Logs from your program will appear here"
warn "Logs from your program will appear here"

# Uncomment this block to pass the first stage
# if match_pattern(input_line, pattern)
Expand Down
2 changes: 1 addition & 1 deletion starter_templates/rust/code/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fn match_pattern(input_line: &str, pattern: &str) -> bool {
// Usage: echo <input_text> | your_program.sh -E <pattern>
fn main() {
// You can use print statements as follows for debugging, they'll be visible when running tests.
println!("Logs from your program will appear here!");
eprintln!("Logs from your program will appear here!");

if env::args().nth(1).unwrap() != "-E" {
println!("Expected first argument to be '-E'");
Expand Down
2 changes: 1 addition & 1 deletion starter_templates/typescript/code/app/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (args[2] !== "-E") {
}

// You can use print statements as follows for debugging, they'll be visible when running tests.
console.log("Logs from your program will appear here!");
console.error("Logs from your program will appear here!");

// Uncomment this block to pass the first stage
// if (matchPattern(inputLine, pattern)) {
Expand Down

0 comments on commit 8074ad1

Please sign in to comment.