Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d33a9ca033 | ||
|
|
4347a6999c | ||
|
|
510f168932 | ||
|
|
89b0038d58 | ||
|
|
d8253fcc30 | ||
|
|
1dea6c479d | ||
|
|
ee8ab46a53 | ||
|
|
b11d13ac61 | ||
|
|
2b07013ad7 |
@@ -44,5 +44,5 @@ jobs:
|
|||||||
|
|
||||||
- name: Publish to Gitea Cargo registry
|
- name: Publish to Gitea Cargo registry
|
||||||
env:
|
env:
|
||||||
CARGO_REGISTRIES_GITEA_TOKEN: ${{ secrets.CARGO_TOKEN }}
|
CARGO_REGISTRIES_GITEA_TOKEN: "Bearer ${{ secrets.CARGO_TOKEN }}"
|
||||||
run: nix develop --extra-experimental-features "nix-command flakes" -c cargo publish --registry gitea --verbose
|
run: nix develop --extra-experimental-features "nix-command flakes" -c cargo publish --registry gitea --verbose
|
||||||
Generated
+6
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="uk.co.ben_gibson.git.link.SettingsState">
|
||||||
|
<option name="host" value="e0f86390-1091-4871-8aeb-f534fbc99cf0" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Generated
+1
-10
@@ -4,13 +4,4 @@ version = 4
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kt_log"
|
name = "kt_log"
|
||||||
version = "0.1.0"
|
version = "0.1.4"
|
||||||
dependencies = [
|
|
||||||
"log",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "log"
|
|
||||||
version = "0.4.33"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad"
|
|
||||||
|
|||||||
+1
-3
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kt_log"
|
name = "kt_log"
|
||||||
version = "0.1.0"
|
version = "0.1.4"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
description = "A console logging library for Rust applications"
|
description = "A console logging library for Rust applications"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
@@ -11,5 +11,3 @@ autobins = false
|
|||||||
name = "kt_log"
|
name = "kt_log"
|
||||||
path = "src/lib.rs"
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
log = "0.4"
|
|
||||||
@@ -11,6 +11,9 @@ This project is intended for educational purposes. To support this, please adher
|
|||||||
- **Source Code Editing:** You are NOT allowed to edit the executable source code (`src/` directory) except to improve documentation..
|
- **Source Code Editing:** You are NOT allowed to edit the executable source code (`src/` directory) except to improve documentation..
|
||||||
- **Code Generation:** Do not provide example code unless explicitly asked by the user.
|
- **Code Generation:** Do not provide example code unless explicitly asked by the user.
|
||||||
|
|
||||||
|
## CI/CD & Registry Requirements
|
||||||
|
- **Gitea Cargo Registry Token Format:** When configuring authentication tokens for the Gitea Cargo package registry (in CI workflows via `CARGO_REGISTRIES_<NAME>_TOKEN` or in `~/.cargo/credentials.toml`), the token MUST include the `"Bearer "` prefix (e.g., `CARGO_REGISTRIES_GITEA_TOKEN: "Bearer ${{ secrets.CARGO_TOKEN }}"` or `token = "Bearer <token>"`). Cargo passes the token verbatim into the `Authorization` HTTP header, and Gitea requires the standard `Bearer ` scheme prefix; passing a raw token without `Bearer ` causes `401 Unauthorized: Failed to authenticate user`.
|
||||||
|
|
||||||
## Communication Guidelines
|
## Communication Guidelines
|
||||||
- **Educational Focus:** When asked about code, prioritize explaining the concepts and providing advice over writing code.
|
- **Educational Focus:** When asked about code, prioritize explaining the concepts and providing advice over writing code.
|
||||||
- **Documentation Links:** Always include links to official language or library documentation for references.
|
- **Documentation Links:** Always include links to official language or library documentation for references.
|
||||||
|
|||||||
+6
-28
@@ -1,30 +1,8 @@
|
|||||||
// src/lib.rs
|
pub struct Clogger{
|
||||||
//! Console logging utilities for Rust applications.
|
|
||||||
|
|
||||||
use log::{Level, LevelFilter, Metadata, Record, SetLoggerError};
|
|
||||||
|
|
||||||
/// A minimal console logger implementation.
|
|
||||||
pub struct ConsoleLogger;
|
|
||||||
|
|
||||||
static LOGGER: ConsoleLogger = ConsoleLogger;
|
|
||||||
|
|
||||||
impl log::Log for ConsoleLogger {
|
|
||||||
fn enabled(&self, metadata: &Metadata<'_>) -> bool {
|
|
||||||
metadata.level() <= Level::Info
|
|
||||||
}
|
|
||||||
|
|
||||||
fn log(&self, record: &Record<'_>) {
|
|
||||||
if self.enabled(record.metadata()) {
|
|
||||||
println!("[{}] {}", record.level(), record.args());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn flush(&self) {}
|
|
||||||
}
|
}
|
||||||
|
impl Clogger{
|
||||||
/// Initializes the console logger with `Info` as the maximum log level.
|
pub fn output(){
|
||||||
pub fn init() -> Result<(), SetLoggerError> {
|
println!("Hello, world!");
|
||||||
log::set_logger(&LOGGER)?;
|
}
|
||||||
log::set_max_level(LevelFilter::Info);
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user