pub struct GoogleLogger<M: LogMapper> { /* private fields */ }Expand description
A logger that writes entries to Google Cloud Logging using the entries.write API.
Implementations§
Source§impl<M: LogMapper> GoogleLogger<M>
impl<M: LogMapper> GoogleLogger<M>
Sourcepub fn new(
log_label: Arc<str>,
credential_bytes: impl AsRef<[u8]>,
mapper: M,
) -> Result<GoogleLogger<M>, LoggerError>
pub fn new( log_label: Arc<str>, credential_bytes: impl AsRef<[u8]>, mapper: M, ) -> Result<GoogleLogger<M>, LoggerError>
Creates a new GoogleLogger with the given log label, service account credentials, and log mapper.
Sourcepub async fn write_logs(
&mut self,
log_entry: Vec<Value>,
) -> Result<(), LoggerError>
pub async fn write_logs( &mut self, log_entry: Vec<Value>, ) -> Result<(), LoggerError>
Sends a batch of log entries to Google Cloud Logging.
Each entry is passed through the configured LogMapper before being sent.
pub fn context(&self) -> LogContext
Trait Implementations§
Auto Trait Implementations§
impl<M> Freeze for GoogleLogger<M>where
M: Freeze,
impl<M> !RefUnwindSafe for GoogleLogger<M>
impl<M> Send for GoogleLogger<M>
impl<M> Sync for GoogleLogger<M>
impl<M> Unpin for GoogleLogger<M>where
M: Unpin,
impl<M> UnsafeUnpin for GoogleLogger<M>where
M: UnsafeUnpin,
impl<M> !UnwindSafe for GoogleLogger<M>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more