Skip to content
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

[Sink] Simple file sink #3

Open
MarcSchaetz opened this issue Dec 11, 2022 · 0 comments
Open

[Sink] Simple file sink #3

MarcSchaetz opened this issue Dec 11, 2022 · 0 comments
Milestone

Comments

@MarcSchaetz
Copy link
Owner

MarcSchaetz commented Dec 11, 2022

We need a Sink for writing to a file. This should be really simple because other sinks will take on the taks of writing in specific manners to files (daily, rotating, ...).

The file should be opened when the sink is created and closed when the sink is destroyed.

On logger.flush() the logged messages should be written to the sink. logger.log() should hold it in memory

stateDiagram-v2
[*]
file_open: File open
file_closed: File closed
[*] --> file_open: Sink created
file_open --> file_closed: Sink destroyed
file_closed -->[*]

Loading
sequenceDiagram
participant logger as Logger
participant sink as FileSink
participant file as File

activate logger
logger --> sink: Add sink to logger

activate sink
logger ->> sink: log message
logger ->> sink: log message
logger ->> sink: flush
sink ->> file: Open file
activate file
sink ->> file: write to file
logger ->> sink: log message
logger ->> sink: log message
logger ->> sink: flush
sink ->> file: write to file
logger --> sink: remove sink
sink ->> file: close file
deactivate sink
deactivate file
deactivate logger
Loading
@MarcSchaetz MarcSchaetz added this to the v0.2 milestone Dec 11, 2022
MarcSchaetz added a commit that referenced this issue Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant