-
Notifications
You must be signed in to change notification settings - Fork 327
Core revamp part 2 #252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Core revamp part 2 #252
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8b06916
isolate tide-headers, tide-slog; better; improve loggers
prasannavl 225a43d
add logging examples
prasannavl 9e96166
Merge branch 'master' of ssh://github.com/rustasync/tide
prasannavl 7d9e136
cargo fmt
prasannavl 8aac219
add tide dev-dep to all crates
prasannavl f41754b
fixup manifest documentation links
prasannavl 476d75b
Update Cargo.toml
fairingrey f354835
capitalize Tide in crate desc
fairingrey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#![feature(async_await)] | ||
fn main() { | ||
env_logger::from_env(env_logger::Env::default().default_filter_or("info")).init(); | ||
let mut app = tide::App::new(); | ||
app.middleware(tide::middleware::RequestLogger::new()); | ||
app.at("/").get(async move |_| "Hello, world!"); | ||
app.run("127.0.0.1:8000").unwrap(); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#![feature(async_await)] | ||
fn main() { | ||
use log::LevelFilter; | ||
use log4rs::append::console::ConsoleAppender; | ||
use log4rs::config::{Appender, Config, Root}; | ||
|
||
let stdout = ConsoleAppender::builder().build(); | ||
let config = Config::builder() | ||
.appender(Appender::builder().build("stdout", Box::new(stdout))) | ||
.build(Root::builder().appender("stdout").build(LevelFilter::Info)) | ||
.unwrap(); | ||
let _handle = log4rs::init_config(config).unwrap(); | ||
|
||
let mut app = tide::App::new(); | ||
app.middleware(tide::middleware::RequestLogger::new()); | ||
app.at("/").get(async move |_| "Hello, world!"); | ||
app.run("127.0.0.1:8000").unwrap(); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
mod default_headers; | ||
mod logger; | ||
// Core | ||
pub use tide_core::middleware::{Middleware, Next}; | ||
|
||
// Exports from tide repo. | ||
pub use tide_headers::DefaultHeaders; | ||
pub use tide_log::RequestLogger; | ||
|
||
pub use self::{default_headers::DefaultHeaders, logger::RootLogger}; | ||
#[cfg(feature = "cookies")] | ||
pub use tide_cookies::CookiesMiddleware; | ||
pub use tide_core::middleware::{Middleware, Next}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[package] | ||
authors = [ | ||
"Tide Developers" | ||
] | ||
description = "Header related middleware for Tide" | ||
documentation = "https://docs.rs/tide-headers" | ||
keywords = ["tide", "web", "async", "middleware", "headers"] | ||
categories = [ | ||
"network-programming", | ||
"web-programming::http-server", | ||
] | ||
edition = "2018" | ||
license = "MIT OR Apache-2.0" | ||
name = "tide-headers" | ||
readme = "README.md" | ||
repository = "https://github.com/rustasync/tide" | ||
version = "0.1.0" | ||
|
||
[dependencies] | ||
tide-core = { path = "../tide-core" } | ||
futures-preview = "0.3.0-alpha.16" | ||
http = "0.1" | ||
log = "0.4.6" | ||
|
||
[dev-dependencies] | ||
tide = { path = "../" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[package] | ||
authors = [ | ||
"Tide Developers" | ||
] | ||
description = "Logging middleware for Tide based on slog" | ||
documentation = "https://docs.rs/tide-slog" | ||
keywords = ["tide", "web", "async", "middleware", "logging", "slog"] | ||
categories = [ | ||
"logging", | ||
"network-programming", | ||
"web-programming::http-server", | ||
] | ||
edition = "2018" | ||
license = "MIT OR Apache-2.0" | ||
name = "tide-slog" | ||
readme = "README.md" | ||
repository = "https://github.com/rustasync/tide" | ||
version = "0.1.0" | ||
|
||
[dependencies] | ||
tide-core = { path = "../tide-core" } | ||
futures-preview = "0.3.0-alpha.16" | ||
http = "0.1" | ||
log = "0.4.6" | ||
slog = "2.4.1" | ||
slog-async = "2.3.0" | ||
slog-term = "2.4.0" | ||
|
||
[dev-dependencies] | ||
tide = { path = "../" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.