Comments (20)
Maybe we should ship
StdoutLogHandler
andStderrLogHandler
.
yeah, could just have a LogStdioHandler
that takes a FILE *
or a file descriptor... And make the default either LogStdioHandler(stdout)
or LogStdioHandler(stderr)
from swift-log.
I'd be okay with that, but we should name it StderrHandler
and make it log to stderr
:). It's no good logging to stdout but I forgot to fix it...
from swift-log.
Maybe we should ship StdoutLogHandler
and StderrLogHandler
.
from swift-log.
👍 on shipping both, makes sense and does not widen the scope of the lib too much; this still counts as "bare minimum" etc. I think.
Btw. re 12-factor apps... the rules are ok-ish... but in reality some of the hints are very weird (the configuration one + security springs to mind), so it's good as general inspiration but I don't think one should follow those when designing APIs like a bible of app design :-)
from swift-log.
Thanks for all the feedback here. Just wanted to say I can make StdoutLogHandler
public via a PR, but the other proposals seems a bit out of scope for me!
from swift-log.
fixed by #61
from swift-log.
Hi Allen, really cool that you're looking to adopt the API, and thanks for chiming in!
As you notice, it is early days here, and not many implementations of this API exist yet. Our hope is that soon someone would implement a much better standard out logger that would support formatting etc. It is true though that the built in one provides a nice out of the box default...
I think it sounds good on making it public, it seems to have been intended to be so; and it is accessible in any case for using it via "not configuring anything"; We could also address the docs comment on it while we're at it (perhaps something more clear that it's "boring" :-)), mentioning that it is intended to be a bare-minimum implementation and proper log handlers with formatting are expected to be external modules?
We'll see what @weissi and @tomerd think, but sounds to me like a plan to have it publicly constructable, since we "ship it" and it is "to be used by users" anyway.
from swift-log.
Why stderr? https://12factor.net/logs
from swift-log.
Why stderr? https://12factor.net/logs
Command line apps are pretty unusable if you log to stdout
. Imagine you do
cat myImage.HEIC | my-swift-heic-to-jpg-transcoder > myImage.jpg
that'd break horribly if you log to stdout
. Obviously we could say in that case people need to install their own log handler...
from swift-log.
I dug around a bit.
kubectl logs
aggregates stdout
and stderr
.
Cloud Foundry does the same - https://docs.cloudfoundry.org/devguide/deploy-apps/streaming-logs.html
Mesos likewise - http://mesos.apache.org/documentation/latest/logging/#Containers
Maybe the 12-factor requirement of stdout
isn't realistic in practice..
from swift-log.
I dug around a bit.
kubectl logs
aggregatesstdout
andstderr
.
Cloud Foundry does the same - https://docs.cloudfoundry.org/devguide/deploy-apps/streaming-logs.html
Mesos likewise - http://mesos.apache.org/documentation/latest/logging/#ContainersMaybe the 12-factor requirement of
stdout
isn't realistic in practice..
Yeah, I find it a bit odd that they require stdout
... Anyway, I guess the best argument for leaving it stdout
is that we shipped 1.0.0 with it and you could say it's a breaking change...
from swift-log.
Yeah. I do think we should make StdoutLogHandler
public - for the 12-factor style of app it's useful.
from swift-log.
@ianpartridge 2>&1
would make a stderr-logging thing 12-factor again, so I don't think whatever 12-factor came up with should be the deciding argument here.
All real-world deployments will definitely have to take anything on stderr
too because that's where Swift crashes get written too.
from swift-log.
@allenhumphreys I think we'd welcome that first PR :)
from swift-log.
@ianpartridge I went to commit and was following CONTRIBUTING.md
's advice to use dev/git.commit.template
as the commit template, but found that seems to be a holdover from where this project started (SwiftNIO?).
As part of my update I could:
- Add the template so the instructions are accurate
- Update the instructions so they don't reference the template
from swift-log.
Ah, thanks for letting us know. I think we should fix that in a separate PR - @weissi?
from swift-log.
I think we should fix that in a separate PR - @weissi?
Yes please :)
from swift-log.
I think we should fix that in a separate PR -
from swift-log.
Seems we missed to close this issue; Seems solved ( by #61 and see also https://github.com/apple/swift-log/blob/master/Sources/Logging/Logging.swift#L539-L549 )
from swift-log.
Assigned to 1.0.1 milestone, and closed the 1.0.0 milestone as well since it seems to have been still open even tho we tagged 1.0.0.
from swift-log.
Related Issues (20)
- Toggle verbose or off HOT 1
- Crash when using error log / Incomplete LogHandler implementation HOT 2
- Infinite recursion between deprecated API's HOT 4
- MultiplexLogHandler to learn about metadata providers
- Add new Discord Logger to README HOT 2
- Make `StdioOutputStream` public HOT 1
- Supported way of accumulating metadata down the callstack HOT 9
- Logging function autoclosures aren't "rethrows" HOT 8
- Simplify logging `Error` types HOT 4
- Support advanced loghandler metadata use cases HOT 2
- Make StreamLogHandler initializers public
- How should I disclose using Swift Log in my iOS app?
- Unsupported runtime for visionOS HOT 1
- Fails to compile on Fedora 39 with Swift 5.8.1 (From repos) or official 5.9 binaries HOT 7
- PrivacyInfo Manifest HOT 2
- visionOS Compatibility HOT 1
- "Unsupported Runtime" when compiling for xrOS HOT 2
- Adding Error to log functions HOT 2
- CoW (copy-on-write) box the `Logger` components (for perf) HOT 2
- .string and .stringConvertable metadata value equality HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swift-log.