Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a64dd7dafc | ||
|
|
ca922e38f5 | ||
|
|
09c2837476 | ||
|
|
55c927dd31 | ||
|
|
17d1835dac | ||
|
|
643fdba31a | ||
|
|
d81e7db5f7 | ||
|
|
870e880fc4 | ||
|
|
e65117937a | ||
|
|
ef8cc5a5d5 | ||
|
|
b4dfce827c | ||
|
|
e60caa9502 | ||
|
|
4c01a824b7 | ||
|
|
bee6142a07 | ||
|
|
399f98f61f | ||
|
|
c217b32d46 | ||
|
|
f0a5088707 | ||
|
|
766ff20cc8 | ||
|
|
98886523fb | ||
|
|
3eba0ff608 | ||
|
|
284bf1fdeb | ||
|
|
1039ca5db2 | ||
|
|
94caaf2910 | ||
|
|
3f53e0ab50 | ||
|
|
46735c242a | ||
|
|
78b84e39ff | ||
|
|
7dd7738627 | ||
|
|
306f432f6c | ||
|
|
c693fb6db1 | ||
|
|
6254844827 | ||
|
|
7db09d7d68 | ||
|
|
c7583429a6 | ||
|
|
045ba36718 | ||
|
|
9bd90f06ba | ||
|
|
45c6d10678 | ||
|
|
aa3990dfa0 | ||
|
|
b0e59933ac | ||
|
|
5c135cd948 | ||
|
|
32e9fa5158 | ||
|
|
1b17eac10e | ||
|
|
034334268a | ||
|
|
2474d61a80 | ||
|
|
03174f3260 | ||
|
|
ed51baef90 | ||
|
|
91f6b1017c | ||
|
|
66bd922254 | ||
|
|
466a7ed384 | ||
|
|
11ea26a505 | ||
|
|
1d983153b4 | ||
|
|
0bf0588b17 | ||
|
|
d370d101be | ||
|
|
b96c0e2b61 | ||
|
|
ba9eac9055 | ||
|
|
899b7cb9db | ||
|
|
dfffdaa429 | ||
|
|
a0c3ceabdf | ||
|
|
5ca706eb48 | ||
|
|
19d987b6d5 | ||
|
|
5527732754 | ||
|
|
c7ac24db1f | ||
|
|
e658d61717 | ||
|
|
1f1965107f | ||
|
|
9027df5f03 | ||
|
|
207bedfa31 | ||
|
|
0f23cda751 | ||
|
|
132af4ff5a | ||
|
|
3ff1b2d3f5 | ||
|
|
05379f3987 | ||
|
|
11df2dc68b | ||
|
|
ed535d4ec8 | ||
|
|
50a8c8fdac | ||
|
|
c7c54cc237 | ||
|
|
b5dcb3140e | ||
|
|
a4cb92d526 | ||
|
|
bf76e03ea3 | ||
|
|
d3fc8c10e4 | ||
|
|
edd354fa76 | ||
|
|
c5c893e7ff | ||
|
|
d756065630 |
No files matched your search
@@ -0,0 +1,9 @@
|
||||
.DS_Store
|
||||
/.build
|
||||
/Packages
|
||||
/*.xcodeproj
|
||||
.xcode
|
||||
DerivedData
|
||||
|
||||
.SourceKitten/
|
||||
docs/
|
||||
@@ -0,0 +1,6 @@
|
||||
Tomer Doron <tomer@apple.com> <tomer.doron@gmail.com>
|
||||
Tomer Doron <tomer@apple.com> tomer doron <tomer@apple.com>
|
||||
Tomer Doron <tomer@apple.com> tomer doron <tomerd@apple.com>
|
||||
Johannes Weiss <johannesweiss@apple.com> <johannes@jweiss.io>
|
||||
Max Moiseev <moiseev@apple.com> <moiseev@users.noreply.github.com>
|
||||
Konrad `ktoso` Malawski <ktoso@apple.com> <konrad.malawski@project13.pl>
|
||||
@@ -0,0 +1,55 @@
|
||||
# Code of Conduct
|
||||
To be a truly great community, SwiftLog needs to welcome developers from all walks of life,
|
||||
with different backgrounds, and with a wide range of experience. A diverse and friendly
|
||||
community will have more great ideas, more unique perspectives, and produce more great
|
||||
code. We will work diligently to make the SwiftLog community welcoming to everyone.
|
||||
|
||||
To give clarity of what is expected of our members, SwiftLog has adopted the code of conduct
|
||||
defined by [contributor-covenant.org](https://www.contributor-covenant.org). This document is used across many open source
|
||||
communities, and we think it articulates our values well. The full text is copied below:
|
||||
|
||||
### Contributor Code of Conduct v1.3
|
||||
As contributors and maintainers of this project, and in the interest of fostering an open and
|
||||
welcoming community, we pledge to respect all people who contribute through reporting
|
||||
issues, posting feature requests, updating documentation, submitting pull requests or patches,
|
||||
and other activities.
|
||||
|
||||
We are committed to making participation in this project a harassment-free experience for
|
||||
everyone, regardless of level of experience, gender, gender identity and expression, sexual
|
||||
orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or
|
||||
nationality.
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
- The use of sexualized language or imagery
|
||||
- Personal attacks
|
||||
- Trolling or insulting/derogatory comments
|
||||
- Public or private harassment
|
||||
- Publishing other’s private information, such as physical or electronic addresses, without explicit permission
|
||||
- Other unethical or unprofessional conduct
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments,
|
||||
commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of
|
||||
Conduct, or to ban temporarily or permanently any contributor for other behaviors that they
|
||||
deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
By adopting this Code of Conduct, project maintainers commit themselves to fairly and
|
||||
consistently applying these principles to every aspect of managing this project. Project
|
||||
maintainers who do not follow or enforce the Code of Conduct may be permanently removed
|
||||
from the project team.
|
||||
|
||||
This code of conduct applies both within project spaces and in public spaces when an
|
||||
individual is representing the project or its community.
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by
|
||||
contacting a project maintainer at [swift-log-conduct@group.apple.com](mailto:swift-log-conduct@group.apple.com). All complaints will be reviewed and
|
||||
investigated and will result in a response that is deemed necessary and appropriate to the
|
||||
circumstances. Maintainers are obligated to maintain confidentiality with regard to the reporter
|
||||
of an incident.
|
||||
|
||||
*This policy is adapted from the Contributor Code of Conduct [version 1.3.0](https://contributor-covenant.org/version/1/3/0/).*
|
||||
|
||||
### Reporting
|
||||
A working group of community members is committed to promptly addressing any [reported issues](mailto:swift-log-conduct@group.apple.com).
|
||||
Working group members are volunteers appointed by the project lead, with a
|
||||
preference for individuals with varied backgrounds and perspectives. Membership is expected
|
||||
to change regularly, and may grow or shrink.
|
||||
@@ -0,0 +1,27 @@
|
||||
For the purpose of tracking copyright, this is the list of individuals and
|
||||
organizations who have contributed source code to the Swift Logging API.
|
||||
|
||||
For employees of an organization/company where the copyright of work done
|
||||
by employees of that company is held by the company itself, only the company
|
||||
needs to be listed here.
|
||||
|
||||
## COPYRIGHT HOLDERS
|
||||
|
||||
- Apple Inc. (all contributors with '@apple.com')
|
||||
|
||||
### Contributors
|
||||
|
||||
- David Hart <david@hartbit.com>
|
||||
- Iain Smith <iainsmith@users.noreply.github.com>
|
||||
- Ian Partridge <i.partridge@uk.ibm.com>
|
||||
- Johannes Weiss <johannesweiss@apple.com>
|
||||
- Kevin Sweeney <kevin.t.sweeney@gmail.com>
|
||||
- Konrad `ktoso` Malawski <ktoso@apple.com>
|
||||
- Max Moiseev <moiseev@apple.com>
|
||||
- Tanner <me@tanner.xyz>
|
||||
- Thomas Krajacic <tkrajacic@users.noreply.github.com>
|
||||
- Tomer Doron <tomer@apple.com>
|
||||
|
||||
**Updating this list**
|
||||
|
||||
Please do not edit this file manually. It is generated using `./scripts/generate_contributors_list.sh`. If a name is misspelled or appearing multiple times: add an entry in `./.mailmap`
|
||||
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,33 @@
|
||||
// swift-tools-version:5.0
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Logging API open source project
|
||||
//
|
||||
// Copyright (c) 2018-2019 Apple Inc. and the Swift Logging API project authors
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of Swift Logging API project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "swift-log",
|
||||
products: [
|
||||
.library(name: "Logging", targets: ["Logging"]),
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
name: "Logging",
|
||||
dependencies: []
|
||||
),
|
||||
.testTarget(
|
||||
name: "LoggingTests",
|
||||
dependencies: ["Logging"]
|
||||
),
|
||||
]
|
||||
)
|
||||
@@ -0,0 +1,164 @@
|
||||
# swift-log
|
||||
|
||||
A Logging API package for Swift. Version `1.0.0` requires Swift 5.0 but in due course we will also tag a mostly compatible version for Swift 4 (which will be tagged `0.x`) to ease your transition towards Swift 5.
|
||||
|
||||
First things first: This is the beginning of a community-driven open-source project actively seeking contributions, be it code, documentation, or ideas. Apart from contributing to `swift-log` itself, there's another huge gap at the moment: `swift-log` is an _API package_ which tries to establish a common API the ecosystem can use. To make logging really work for real-world workloads, we need `swift-log`-compatible _logging backends_ which then either persist the log messages in files, render them in nicer colors on the terminal, or send them over to Splunk or ELK.
|
||||
|
||||
What `swift-log` provides today can be found in the [API docs][api-docs].
|
||||
|
||||
## Great, what's the tl;dr
|
||||
|
||||
If you have a server-side Swift application, or maybe a cross-platform (for example Linux & macOS) app/library, and you would like to log, we think targeting this logging API package is a great idea. Below you'll find all you need to know to get started.
|
||||
|
||||
#### Adding the dependency
|
||||
|
||||
`swift-log` is designed for Swift 5, the `1.0.0` release requires Swift 5 (however we will soon tag a `0.x` version that will work with Swift 4 for the transition period). To depend on the logging API package, you need to declare your dependency in your `Package.swift`:
|
||||
|
||||
```swift
|
||||
.package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"),
|
||||
```
|
||||
|
||||
and to your application/library target, add `"Logging"` to your `dependencies`, e.g. like this:
|
||||
|
||||
```swift
|
||||
.target(name: "BestExampleApp", dependencies: ["Logging']),
|
||||
```
|
||||
|
||||
#### Let's log
|
||||
|
||||
```swift
|
||||
// 1) let's import the logging API package
|
||||
import Logging
|
||||
|
||||
// 2) we need to create a logger, the label works similarly to a DispatchQueue label
|
||||
let logger = Logger(label: "com.example.BestExampleApp.main")
|
||||
|
||||
// 3) we're now ready to use it
|
||||
logger.info("Hello World!")
|
||||
```
|
||||
|
||||
#### Output
|
||||
|
||||
```
|
||||
2019-03-13T15:46:38+0000 info: Hello World!
|
||||
```
|
||||
|
||||
For further information, please check the [API documentation][api-docs].
|
||||
|
||||
## What is an API package?
|
||||
|
||||
Glad you asked. We believe that for the Swift on Server ecosystem, it's crucial to have a logging API that can be adopted by anybody so a multitude of libraries from different parties can all log to a shared destination. More concretely this means that we believe all the log messages from all libraries end up in the same file, database, Elastic Stack/Splunk instance, or whatever you may choose.
|
||||
|
||||
In the real-world however, there are so many opinions over how exactly a logging system should behave, what a log message should be formatted like, and where/how it should be persisted. We think it's not feasible to wait for one logging package to support everything that a specific deployment needs whilst still being easy enough to use and remain performant. That's why we decided to cut the problem in half:
|
||||
|
||||
1. a logging API
|
||||
2. a logging backend implementation
|
||||
|
||||
This package only provides the logging API itself and therefore `swift-log` is a 'logging API package'. `swift-log` (using `LoggingSystem.bootstrap`) can be configured to choose any compatible logging backend implementation. This way packages can adopt the API and the _application_ can choose any compatible logging backend implementation without requiring any changes from any of the libraries.
|
||||
|
||||
Just for completeness sake: This API package does actually include an overly simplistic and non-configurable logging backend implementation which simply writes all log messages to `stdout`. The reason to include this overly simplistic logging backend implementation is to improve the first-time usage experience. Let's assume you start a project and try out `swift-log` for the first time, it's just a whole lot better to see something you logged appear on `stdout` in a simplistic format rather than nothing happening at all. For any real-world application, we advise configuring another logging backend implementation that logs in the style you like.
|
||||
|
||||
## The core concepts
|
||||
|
||||
### Loggers
|
||||
|
||||
`Logger`s are used to emit log messages and therefore the most important type in `swift-log`, so their use should be as simple as possible. Most commonly, they are used to emit log messages in a certain log level. For example:
|
||||
|
||||
```swift
|
||||
// logging an informational message
|
||||
logger.info("Hello World!")
|
||||
|
||||
// ouch, something went wrong
|
||||
logger.error("Houston, we have a problem: \(problem)")
|
||||
```
|
||||
|
||||
### Log levels
|
||||
|
||||
The following log levels are supported, they match the [syslog severity levels](https://en.wikipedia.org/wiki/Syslog#Severity_level):
|
||||
|
||||
- `debug`
|
||||
- `info`
|
||||
- `notice`
|
||||
- `warning`
|
||||
- `error`
|
||||
- `critical`
|
||||
- `alert`
|
||||
- `emergency`
|
||||
|
||||
The log level of a given logger can be changed, but the change will only affect the specific logger you changed it on. You could say the `Logger` is a _value type_ regarding the log level.
|
||||
|
||||
|
||||
### Logging metadata
|
||||
|
||||
Logging metadata is metadata that can be attached to loggers to add information that is crucial when debugging a problem. In servers, the usual example is attaching a request UUID to a logger that will then be present on all log messages logged with that logger. Example:
|
||||
|
||||
```swift
|
||||
var logger = logger
|
||||
logger[metadataKey: "request-uuid"] = "\(UUID())"
|
||||
logger.info("hello world")
|
||||
```
|
||||
|
||||
will print
|
||||
|
||||
```
|
||||
2019-03-13T18:30:02+0000 info: request-uuid=F8633013-3DD8-481C-9256-B296E43443ED hello world
|
||||
```
|
||||
|
||||
with the default logging backend implementation that ships with `swift-log`. Needless to say, the format is fully defined by the logging backend you choose.
|
||||
|
||||
## On the implementation of a logging backend (a `LogHandler`)
|
||||
|
||||
Note: If you don't want to implement a custom logging backend, everything in this section is probably not very relevant, so please feel free to skip.
|
||||
|
||||
To become a compatible logging backend that all `swift-log` consumers can use, you need to do two things: 1) Implement a type (usually a `struct`) that implements `LogHandler`, a protocol provided by `swift-log` and 2) instruct `swift-log` to use your logging backend implementation.
|
||||
|
||||
A `LogHandler` or logging backend implementation is anything that conforms to the following protocol
|
||||
|
||||
```swift
|
||||
public protocol LogHandler {
|
||||
func log(level: Logger.Level, message: Logger.Message, metadata: Logger.Metadata?, file: String, function: String, line: UInt)
|
||||
|
||||
subscript(metadataKey _: String) -> Logger.Metadata.Value? { get set }
|
||||
|
||||
var metadata: Logger.Metadata { get set }
|
||||
|
||||
var logLevel: Logger.Level { get set }
|
||||
}
|
||||
```
|
||||
|
||||
Instructing `swift-log` to use your logging backend as the one the whole application (including all libraries) should use is very simple:
|
||||
|
||||
LoggingSystem.bootstrap(MyLogHandler.init)
|
||||
|
||||
### Implementation considerations
|
||||
|
||||
`LogHandler`s control most parts of the logging system:
|
||||
|
||||
#### Under control of a `LogHandler`
|
||||
|
||||
##### Configuration
|
||||
|
||||
`LogHandler`s control the two crucial pieces of `Logger` configuration, namely:
|
||||
|
||||
- log level (`logger.logLevel` property)
|
||||
- logging metadata (`logger[metadataKey:]` and `logger.metadata`)
|
||||
|
||||
For the system to work, however, it is important that `LogHandler` treat the configuration as _value types_. This means that `LogHandler`s should be `struct`s and a change in log level or logging metadata should only affect the very `LogHandler` it was changed on.
|
||||
|
||||
However, in special cases, it is acceptable that a `LogHandler` provides some global log level override that may affect all `LogHandler`s created.
|
||||
|
||||
##### Emitting
|
||||
- emitting the log message itself
|
||||
|
||||
### Not under control of `LogHandler`s
|
||||
|
||||
`LogHandler`s do not control if a message should be logged or not. `Logger` will only invoke the `log` function of a `LogHandler` if `Logger` determines that a log message should be emitted given the configured log level.
|
||||
|
||||
## Design
|
||||
|
||||
This logging API was designed with the contributors to the Swift on Server community and approved by the [SSWG (Swift Server Work Group)](https://swift.org/server/) to the 'sandbox level' of the SSWG's [incubation process](https://github.com/swift-server/sswg/blob/master/process/incubation.md).
|
||||
|
||||
- [pitch](https://forums.swift.org/t/logging/16027), [discussion](https://forums.swift.org/t/discussion-server-logging-api/18834), [feedback](https://forums.swift.org/t/feedback-server-logging-api-with-revisions/19375)
|
||||
- [log levels](https://forums.swift.org/t/logging-levels-for-swifts-server-side-logging-apis-and-new-os-log-apis/20365)
|
||||
|
||||
[api-docs]: https://apple.github.io/swift-log/docs/current/Logging/Structs/Logger.html
|
||||
@@ -0,0 +1,178 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Logging API open source project
|
||||
//
|
||||
// Copyright (c) 2018-2019 Apple Inc. and the Swift Logging API project authors
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of Swift Logging API project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
||||
import Darwin
|
||||
#else
|
||||
import Glibc
|
||||
#endif
|
||||
|
||||
/// A threading lock based on `libpthread` instead of `libdispatch`.
|
||||
///
|
||||
/// This object provides a lock on top of a single `pthread_mutex_t`. This kind
|
||||
/// of lock is safe to use with `libpthread`-based threading models, such as the
|
||||
/// one used by NIO.
|
||||
internal final class Lock {
|
||||
fileprivate let mutex: UnsafeMutablePointer<pthread_mutex_t> = UnsafeMutablePointer.allocate(capacity: 1)
|
||||
|
||||
/// Create a new lock.
|
||||
public init() {
|
||||
let err = pthread_mutex_init(self.mutex, nil)
|
||||
precondition(err == 0)
|
||||
}
|
||||
|
||||
deinit {
|
||||
let err = pthread_mutex_destroy(self.mutex)
|
||||
precondition(err == 0)
|
||||
self.mutex.deallocate()
|
||||
}
|
||||
|
||||
/// Acquire the lock.
|
||||
///
|
||||
/// Whenever possible, consider using `withLock` instead of this method and
|
||||
/// `unlock`, to simplify lock handling.
|
||||
public func lock() {
|
||||
let err = pthread_mutex_lock(self.mutex)
|
||||
precondition(err == 0)
|
||||
}
|
||||
|
||||
/// Release the lock.
|
||||
///
|
||||
/// Whenever possible, consider using `withLock` instead of this method and
|
||||
/// `lock`, to simplify lock handling.
|
||||
public func unlock() {
|
||||
let err = pthread_mutex_unlock(self.mutex)
|
||||
precondition(err == 0)
|
||||
}
|
||||
}
|
||||
|
||||
extension Lock {
|
||||
/// Acquire the lock for the duration of the given block.
|
||||
///
|
||||
/// This convenience method should be preferred to `lock` and `unlock` in
|
||||
/// most situations, as it ensures that the lock will be released regardless
|
||||
/// of how `body` exits.
|
||||
///
|
||||
/// - Parameter body: The block to execute while holding the lock.
|
||||
/// - Returns: The value returned by the block.
|
||||
@inlinable
|
||||
internal func withLock<T>(_ body: () throws -> T) rethrows -> T {
|
||||
self.lock()
|
||||
defer {
|
||||
self.unlock()
|
||||
}
|
||||
return try body()
|
||||
}
|
||||
|
||||
// specialise Void return (for performance)
|
||||
@inlinable
|
||||
internal func withLockVoid(_ body: () throws -> Void) rethrows {
|
||||
try self.withLock(body)
|
||||
}
|
||||
}
|
||||
|
||||
/// A threading lock based on `libpthread` instead of `libdispatch`.
|
||||
///
|
||||
/// This object provides a lock on top of a single `pthread_mutex_t`. This kind
|
||||
/// of lock is safe to use with `libpthread`-based threading models, such as the
|
||||
/// one used by NIO.
|
||||
internal final class ReadWriteLock {
|
||||
fileprivate let rwlock: UnsafeMutablePointer<pthread_rwlock_t> = UnsafeMutablePointer.allocate(capacity: 1)
|
||||
|
||||
/// Create a new lock.
|
||||
public init() {
|
||||
let err = pthread_rwlock_init(self.rwlock, nil)
|
||||
precondition(err == 0)
|
||||
}
|
||||
|
||||
deinit {
|
||||
let err = pthread_rwlock_destroy(self.rwlock)
|
||||
precondition(err == 0)
|
||||
self.rwlock.deallocate()
|
||||
}
|
||||
|
||||
/// Acquire a reader lock.
|
||||
///
|
||||
/// Whenever possible, consider using `withLock` instead of this method and
|
||||
/// `unlock`, to simplify lock handling.
|
||||
public func lockRead() {
|
||||
let err = pthread_rwlock_rdlock(self.rwlock)
|
||||
precondition(err == 0)
|
||||
}
|
||||
|
||||
/// Acquire a writer lock.
|
||||
///
|
||||
/// Whenever possible, consider using `withLock` instead of this method and
|
||||
/// `unlock`, to simplify lock handling.
|
||||
public func lockWrite() {
|
||||
let err = pthread_rwlock_wrlock(self.rwlock)
|
||||
precondition(err == 0)
|
||||
}
|
||||
|
||||
/// Release the lock.
|
||||
///
|
||||
/// Whenever possible, consider using `withLock` instead of this method and
|
||||
/// `lock`, to simplify lock handling.
|
||||
public func unlock() {
|
||||
let err = pthread_rwlock_unlock(self.rwlock)
|
||||
precondition(err == 0)
|
||||
}
|
||||
}
|
||||
|
||||
extension ReadWriteLock {
|
||||
/// Acquire the reader lock for the duration of the given block.
|
||||
///
|
||||
/// This convenience method should be preferred to `lock` and `unlock` in
|
||||
/// most situations, as it ensures that the lock will be released regardless
|
||||
/// of how `body` exits.
|
||||
///
|
||||
/// - Parameter body: The block to execute while holding the lock.
|
||||
/// - Returns: The value returned by the block.
|
||||
@inlinable
|
||||
internal func withReaderLock<T>(_ body: () throws -> T) rethrows -> T {
|
||||
self.lockRead()
|
||||
defer {
|
||||
self.unlock()
|
||||
}
|
||||
return try body()
|
||||
}
|
||||
|
||||
/// Acquire the writer lock for the duration of the given block.
|
||||
///
|
||||
/// This convenience method should be preferred to `lock` and `unlock` in
|
||||
/// most situations, as it ensures that the lock will be released regardless
|
||||
/// of how `body` exits.
|
||||
///
|
||||
/// - Parameter body: The block to execute while holding the lock.
|
||||
/// - Returns: The value returned by the block.
|
||||
@inlinable
|
||||
internal func withWriterLock<T>(_ body: () throws -> T) rethrows -> T {
|
||||
self.lockWrite()
|
||||
defer {
|
||||
self.unlock()
|
||||
}
|
||||
return try body()
|
||||
}
|
||||
|
||||
// specialise Void return (for performance)
|
||||
@inlinable
|
||||
internal func withReaderLockVoid(_ body: () throws -> Void) rethrows {
|
||||
try self.withReaderLock(body)
|
||||
}
|
||||
|
||||
// specialise Void return (for performance)
|
||||
@inlinable
|
||||
internal func withWriterLockVoid(_ body: () throws -> Void) rethrows {
|
||||
try self.withWriterLock(body)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Logging API open source project
|
||||
//
|
||||
// Copyright (c) 2018-2019 Apple Inc. and the Swift Logging API project authors
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of Swift Logging API project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// A `LogHandler` is an implementation of a logging backend.
|
||||
///
|
||||
/// This type is an implementation detail and should not normally be used, unless implementing your own logging backend.
|
||||
/// To use the swift-log API, please refer to the documentation of `Logger`.
|
||||
///
|
||||
/// # Implementation requirements
|
||||
///
|
||||
/// To implement your own `LogHandler` you should respect a few requirements that are necessary so applications work
|
||||
/// as expected regardless of the selected `LogHandler` implementation.
|
||||
///
|
||||
/// - The `LogHandler` must be a `struct`.
|
||||
/// - The metadata and `logLevel` properties must be implemented so that setting them on a `Logger` does not affect
|
||||
/// other `Logger`s.
|
||||
///
|
||||
/// ### Treat log level & metadata as values
|
||||
///
|
||||
/// When developing your `LogHandler`, please make sure the following test works.
|
||||
///
|
||||
/// ```swift
|
||||
/// LoggingSystem.bootstrap(MyLogHandler.init) // your LogHandler might have a different bootstrapping step
|
||||
/// var logger1: Logger(label: "first logger")
|
||||
/// logger1.logLevel = .debug
|
||||
/// logger1[metadataKey: "only-on"] = "first"
|
||||
///
|
||||
/// var logger2 = logger1
|
||||
/// logger2.logLevel = .error // this must not override `logger1`'s log level
|
||||
/// logger2[metadataKey: "only-on"] = "second" // this must not override `logger1`'s metadata
|
||||
///
|
||||
/// XCTAssertEqual(.debug, logger1.logLevel)
|
||||
/// XCTAssertEqual(.error, logger2.logLevel)
|
||||
/// XCTAssertEqual("first", logger1[metadataKey: "only-on"])
|
||||
/// XCTAssertEqual("second", logger2[metadataKey: "only-on"])
|
||||
/// ```
|
||||
///
|
||||
/// ### Special cases
|
||||
///
|
||||
/// In certain special cases, the log level behaving like a value on `Logger` might not be what you want. For example,
|
||||
/// you might want to set the log level across _all_ `Logger`s to `.debug` when say a signal (eg. `SIGUSR1`) is received
|
||||
/// to be able to debug special failures in production. This special case is acceptable but we urge you to create a
|
||||
/// solution specific to your `LogHandler` implementation to achieve that. Please find an example implementation of this
|
||||
/// behavior below, on reception of the signal you would call
|
||||
/// `LogHandlerWithGlobalLogLevelOverride.overrideGlobalLogLevel = .debug`, for example.
|
||||
///
|
||||
/// ```swift
|
||||
/// public struct LogHandlerWithGlobalLogLevelOverride: LogHandler {
|
||||
/// // the static properties hold the globally overridden log level (if overridden)
|
||||
/// private static let overrideLock = Lock()
|
||||
/// private static var overrideLogLevel: Logger.Level? = nil
|
||||
///
|
||||
/// // this holds the log level if not overridden
|
||||
/// private var _logLevel: Logger.Level = .info
|
||||
///
|
||||
/// // metadata storage
|
||||
/// public var metadata: Logger.Metadata = [:]
|
||||
///
|
||||
/// public init(label: String) {
|
||||
/// // [...]
|
||||
/// }
|
||||
///
|
||||
/// public var logLevel: Logger.Level {
|
||||
/// // when we get asked for the log level, we check if it was globally overridden or not
|
||||
/// get {
|
||||
/// return LogHandlerWithGlobalLogLevelOverride.overrideLock.withLock {
|
||||
/// return LogHandlerWithGlobalLogLevelOverride.overrideLogLevel
|
||||
/// } ?? self._logLevel
|
||||
/// }
|
||||
/// // we set the log level whenever we're asked (note: this might not have an effect if globally
|
||||
/// // overridden)
|
||||
/// set {
|
||||
/// self._logLevel = newValue
|
||||
/// }
|
||||
/// }
|
||||
///
|
||||
/// public func log(level: Logger.Level, message: Logger.Message, metadata: Logger.Metadata?,
|
||||
/// file: String, function: String, line: UInt) {
|
||||
/// // [...]
|
||||
/// }
|
||||
///
|
||||
/// public subscript(metadataKey metadataKey: String) -> Logger.Metadata.Value? {
|
||||
/// get {
|
||||
/// return self.metadata[metadataKey]
|
||||
/// }
|
||||
/// set(newValue) {
|
||||
/// self.metadata[metadataKey] = newValue
|
||||
/// }
|
||||
/// }
|
||||
///
|
||||
/// // this is the function to globally override the log level, it is not part of the `LogHandler` protocol
|
||||
/// public static func overrideGlobalLogLevel(_ logLevel: Logger.Level) {
|
||||
/// LogHandlerWithGlobalLogLevelOverride.overrideLock.withLock {
|
||||
/// LogHandlerWithGlobalLogLevelOverride.overrideLogLevel = logLevel
|
||||
/// }
|
||||
/// }
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// Please note that the above `LogHandler` will still pass the 'log level is a value' test above it iff the global log
|
||||
/// level has not been overridden. And most importantly it passes the requirement listed above: A change to the log
|
||||
/// level on one `Logger` should not affect the log level of another `Logger` variable.
|
||||
public protocol LogHandler {
|
||||
/// This method is called when a `LogHandler` must emit a log message. There is no need for the `LogHandler` to
|
||||
/// check if the `level` is above or below the configured `logLevel` as `Logger` already performed this check and
|
||||
/// determined that a message should be logged.
|
||||
///
|
||||
/// - parameters:
|
||||
/// - level: The log level the message was logged at.
|
||||
/// - message: The message to log. To obtain a `String` representation call `message.description`.
|
||||
/// - metadata: The metadata associated to this log message.
|
||||
/// - file: The file the log message was emitted from.
|
||||
/// - function: The function the log line was emitted from.
|
||||
/// - line: The line the log message was emitted from.
|
||||
func log(level: Logger.Level,
|
||||
message: Logger.Message,
|
||||
metadata: Logger.Metadata?,
|
||||
file: String, function: String, line: UInt)
|
||||
|
||||
/// Add, remove, or change the logging metadata.
|
||||
///
|
||||
/// - note: `LogHandler`s must treat logging metadata as a value type. This means that the change in metadata must
|
||||
/// only affect this very `LogHandler`.
|
||||
///
|
||||
/// - parameters:
|
||||
/// - metadataKey: The key for the metadata item
|
||||
subscript(metadataKey _: String) -> Logger.Metadata.Value? { get set }
|
||||
|
||||
/// Get or set the entire metadata storage as a dictionary.
|
||||
///
|
||||
/// - note: `LogHandler`s must treat logging metadata as a value type. This means that the change in metadata must
|
||||
/// only affect this very `LogHandler`.
|
||||
var metadata: Logger.Metadata { get set }
|
||||
|
||||
/// Get or set the configured log level.
|
||||
///
|
||||
/// - note: `LogHandler`s must treat the log level as a value type. This means that the change in metadata must
|
||||
/// only affect this very `LogHandler`. It is acceptable to provide some form of global log level override
|
||||
/// that means a change in log level on a particular `LogHandler` might not be reflected in any
|
||||
/// `LogHandler`.
|
||||
var logLevel: Logger.Level { get set }
|
||||
}
|
||||
@@ -0,0 +1,623 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Logging API open source project
|
||||
//
|
||||
// Copyright (c) 2018-2019 Apple Inc. and the Swift Logging API project authors
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of Swift Logging API project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
||||
import Darwin
|
||||
#else
|
||||
import Glibc
|
||||
#endif
|
||||
|
||||
/// A `Logger` is the central type in `swift-log`. Its central function is to emit log messages using one of the methods
|
||||
/// corresponding to a log level.
|
||||
///
|
||||
/// The most basic usage of a `Logger` is
|
||||
///
|
||||
/// logger.info("Hello World!")
|
||||
///
|
||||
public struct Logger {
|
||||
@usableFromInline
|
||||
var handler: LogHandler
|
||||
public let label: String
|
||||
|
||||
internal init(label: String, _ handler: LogHandler) {
|
||||
self.label = label
|
||||
self.handler = handler
|
||||
}
|
||||
}
|
||||
|
||||
extension Logger {
|
||||
/// Log a message passing the log level as a parameter.
|
||||
///
|
||||
/// If the `logLevel` passed to this method is more severe than the `Logger`'s `logLevel`, it will be logged,
|
||||
/// otherwise nothing will happen.
|
||||
///
|
||||
/// - parameters:
|
||||
/// - level: The log level to log `message` at. For the available log levels, see `Logger.Level`.
|
||||
/// - message: The message to be logged. `message` can be used with any string interpolation literal.
|
||||
/// - metadata: One-off metadata to attach to this log message
|
||||
/// - file: The file this log message originates from (there's usually no need to pass it explicitly as it
|
||||
/// defaults to `#file`.
|
||||
/// - function: The function this log message originates from (there's usually no need to pass it explicitly as
|
||||
/// it defaults to `#file`.
|
||||
/// - line: The line this log message originates from (there's usually no need to pass it explicitly as it
|
||||
/// defaults to `#line`.
|
||||
@inlinable
|
||||
public func log(level: Logger.Level,
|
||||
_ message: @autoclosure () -> Logger.Message,
|
||||
metadata: @autoclosure () -> Logger.Metadata? = nil,
|
||||
file: String = #file, function: String = #function, line: UInt = #line) {
|
||||
if self.logLevel <= level {
|
||||
self.handler.log(level: level,
|
||||
message: message(),
|
||||
metadata: metadata(),
|
||||
file: file, function: function, line: line)
|
||||
}
|
||||
}
|
||||
|
||||
/// Add, change, or remove a logging metadata item.
|
||||
///
|
||||
/// - note: Logging metadata behaves as a value that means a change to the logging metadata will only affect the
|
||||
/// very `Logger` it was changed on.
|
||||
@inlinable
|
||||
public subscript(metadataKey metadataKey: String) -> Logger.Metadata.Value? {
|
||||
get {
|
||||
return self.handler[metadataKey: metadataKey]
|
||||
}
|
||||
set {
|
||||
self.handler[metadataKey: metadataKey] = newValue
|
||||
}
|
||||
}
|
||||
|
||||
/// Get or set the log level configured for this `Logger`.
|
||||
///
|
||||
/// - note: `Logger`s treat `logLevel` as a value. This means that a change in `logLevel` will only affect this
|
||||
/// very `Logger`. It it acceptable for logging backends to have some form of global log level override
|
||||
/// that affects multiple or even all loggers. This means a change in `logLevel` to one `Logger` might in
|
||||
/// certain cases have no effect.
|
||||
@inlinable
|
||||
public var logLevel: Logger.Level {
|
||||
get {
|
||||
return self.handler.logLevel
|
||||
}
|
||||
set {
|
||||
self.handler.logLevel = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Logger {
|
||||
/// Log a message passing with the `Logger.trace` log level.
|
||||
///
|
||||
/// If `.trace` is at least as severe as the `Logger`'s `logLevel`, it will be logged,
|
||||
/// otherwise nothing will happen.
|
||||
///
|
||||
/// - parameters:
|
||||
/// - level: The log level to log `message` at. For the available log levels, see `Logger.Level`.
|
||||
/// - message: The message to be logged. `message` can be used with any string interpolation literal.
|
||||
/// - metadata: One-off metadata to attach to this log message
|
||||
/// - file: The file this log message originates from (there's usually no need to pass it explicitly as it
|
||||
/// defaults to `#file`.
|
||||
/// - function: The function this log message originates from (there's usually no need to pass it explicitly as
|
||||
/// it defaults to `#file`.
|
||||
/// - line: The line this log message originates from (there's usually no need to pass it explicitly as it
|
||||
/// defaults to `#line`.
|
||||
@inlinable
|
||||
public func trace(_ message: @autoclosure () -> Logger.Message,
|
||||
metadata: @autoclosure () -> Logger.Metadata? = nil,
|
||||
file: String = #file, function: String = #function, line: UInt = #line) {
|
||||
self.log(level: .trace, message(), metadata: metadata(), file: file, function: function, line: line)
|
||||
}
|
||||
|
||||
/// Log a message passing with the `Logger.info` log level.
|
||||
///
|
||||
/// If `.debug` is at least as severe as the `Logger`'s `logLevel`, it will be logged,
|
||||
/// otherwise nothing will happen.
|
||||
///
|
||||
/// - parameters:
|
||||
/// - level: The log level to log `message` at. For the available log levels, see `Logger.Level`.
|
||||
/// - message: The message to be logged. `message` can be used with any string interpolation literal.
|
||||
/// - metadata: One-off metadata to attach to this log message
|
||||
/// - file: The file this log message originates from (there's usually no need to pass it explicitly as it
|
||||
/// defaults to `#file`.
|
||||
/// - function: The function this log message originates from (there's usually no need to pass it explicitly as
|
||||
/// it defaults to `#file`.
|
||||
/// - line: The line this log message originates from (there's usually no need to pass it explicitly as it
|
||||
/// defaults to `#line`.
|
||||
@inlinable
|
||||
public func debug(_ message: @autoclosure () -> Logger.Message,
|
||||
metadata: @autoclosure () -> Logger.Metadata? = nil,
|
||||
file: String = #file, function: String = #function, line: UInt = #line) {
|
||||
self.log(level: .debug, message(), metadata: metadata(), file: file, function: function, line: line)
|
||||
}
|
||||
|
||||
/// Log a message passing with the `Logger.Level.info` log level.
|
||||
///
|
||||
/// If `.info` is at least as severe as the `Logger`'s `logLevel`, it will be logged,
|
||||
/// otherwise nothing will happen.
|
||||
///
|
||||
/// - parameters:
|
||||
/// - level: The log level to log `message` at. For the available log levels, see `Logger.Level`.
|
||||
/// - message: The message to be logged. `message` can be used with any string interpolation literal.
|
||||
/// - metadata: One-off metadata to attach to this log message
|
||||
/// - file: The file this log message originates from (there's usually no need to pass it explicitly as it
|
||||
/// defaults to `#file`.
|
||||
/// - function: The function this log message originates from (there's usually no need to pass it explicitly as
|
||||
/// it defaults to `#file`.
|
||||
/// - line: The line this log message originates from (there's usually no need to pass it explicitly as it
|
||||
/// defaults to `#line`.
|
||||
@inlinable
|
||||
public func info(_ message: @autoclosure () -> Logger.Message,
|
||||
metadata: @autoclosure () -> Logger.Metadata? = nil,
|
||||
file: String = #file, function: String = #function, line: UInt = #line) {
|
||||
self.log(level: .info, message(), metadata: metadata(), file: file, function: function, line: line)
|
||||
}
|
||||
|
||||
/// Log a message passing with the `Logger.Level.notice` log level.
|
||||
///
|
||||
/// If `.notice` is at least as severe as the `Logger`'s `logLevel`, it will be logged,
|
||||
/// otherwise nothing will happen.
|
||||
///
|
||||
/// - parameters:
|
||||
/// - level: The log level to log `message` at. For the available log levels, see `Logger.Level`.
|
||||
/// - message: The message to be logged. `message` can be used with any string interpolation literal.
|
||||
/// - metadata: One-off metadata to attach to this log message
|
||||
/// - file: The file this log message originates from (there's usually no need to pass it explicitly as it
|
||||
/// defaults to `#file`.
|
||||
/// - function: The function this log message originates from (there's usually no need to pass it explicitly as
|
||||
/// it defaults to `#file`.
|
||||
/// - line: The line this log message originates from (there's usually no need to pass it explicitly as it
|
||||
/// defaults to `#line`.
|
||||
@inlinable
|
||||
public func notice(_ message: @autoclosure () -> Logger.Message,
|
||||
metadata: @autoclosure () -> Logger.Metadata? = nil,
|
||||
file: String = #file, function: String = #function, line: UInt = #line) {
|
||||
self.log(level: .notice, message(), metadata: metadata(), file: file, function: function, line: line)
|
||||
}
|
||||
|
||||
/// Log a message passing with the `Logger.Level.warning` log level.
|
||||
///
|
||||
/// If `.warning` is at least as severe as the `Logger`'s `logLevel`, it will be logged,
|
||||
/// otherwise nothing will happen.
|
||||
///
|
||||
/// - parameters:
|
||||
/// - level: The log level to log `message` at. For the available log levels, see `Logger.Level`.
|
||||
/// - message: The message to be logged. `message` can be used with any string interpolation literal.
|
||||
/// - metadata: One-off metadata to attach to this log message
|
||||
/// - file: The file this log message originates from (there's usually no need to pass it explicitly as it
|
||||
/// defaults to `#file`.
|
||||
/// - function: The function this log message originates from (there's usually no need to pass it explicitly as
|
||||
/// it defaults to `#file`.
|
||||
/// - line: The line this log message originates from (there's usually no need to pass it explicitly as it
|
||||
/// defaults to `#line`.
|
||||
@inlinable
|
||||
public func warning(_ message: @autoclosure () -> Logger.Message,
|
||||
metadata: @autoclosure () -> Logger.Metadata? = nil,
|
||||
file: String = #file, function: String = #function, line: UInt = #line) {
|
||||
self.log(level: .warning, message(), metadata: metadata(), file: file, function: function, line: line)
|
||||
}
|
||||
|
||||
/// Log a message passing with the `Logger.Level.error` log level.
|
||||
///
|
||||
/// If `.error` is at least as severe as the `Logger`'s `logLevel`, it will be logged,
|
||||
/// otherwise nothing will happen.
|
||||
///
|
||||
/// - parameters:
|
||||
/// - level: The log level to log `message` at. For the available log levels, see `Logger.Level`.
|
||||
/// - message: The message to be logged. `message` can be used with any string interpolation literal.
|
||||
/// - metadata: One-off metadata to attach to this log message
|
||||
/// - file: The file this log message originates from (there's usually no need to pass it explicitly as it
|
||||
/// defaults to `#file`.
|
||||
/// - function: The function this log message originates from (there's usually no need to pass it explicitly as
|
||||
/// it defaults to `#file`.
|
||||
/// - line: The line this log message originates from (there's usually no need to pass it explicitly as it
|
||||
/// defaults to `#line`.
|
||||
@inlinable
|
||||
public func error(_ message: @autoclosure () -> Logger.Message,
|
||||
metadata: @autoclosure () -> Logger.Metadata? = nil,
|
||||
file: String = #file, function: String = #function, line: UInt = #line) {
|
||||
self.log(level: .error, message(), metadata: metadata(), file: file, function: function, line: line)
|
||||
}
|
||||
|
||||
/// Log a message passing with the `Logger.Level.critical` log level.
|
||||
///
|
||||
/// `.critical` messages will always be logged.
|
||||
///
|
||||
/// - parameters:
|
||||
/// - level: The log level to log `message` at. For the available log levels, see `Logger.Level`.
|
||||
/// - message: The message to be logged. `message` can be used with any string interpolation literal.
|
||||
/// - metadata: One-off metadata to attach to this log message
|
||||
/// - file: The file this log message originates from (there's usually no need to pass it explicitly as it
|
||||
/// defaults to `#file`.
|
||||
/// - function: The function this log message originates from (there's usually no need to pass it explicitly as
|
||||
/// it defaults to `#file`.
|
||||
/// - line: The line this log message originates from (there's usually no need to pass it explicitly as it
|
||||
/// defaults to `#line`.
|
||||
@inlinable
|
||||
public func critical(_ message: @autoclosure () -> Logger.Message,
|
||||
metadata: @autoclosure () -> Logger.Metadata? = nil,
|
||||
file: String = #file, function: String = #function, line: UInt = #line) {
|
||||
self.log(level: .critical, message(), metadata: metadata(), file: file, function: function, line: line)
|
||||
}
|
||||
}
|
||||
|
||||
/// The `LoggingSystem` is a global facility where the default logging backend implementation (`LogHandler`) can be
|
||||
/// configured. `LoggingSystem` is set up just once in a given program to set up the desired logging backend
|
||||
/// implementation.
|
||||
public enum LoggingSystem {
|
||||
fileprivate static let lock = ReadWriteLock()
|
||||
fileprivate static var factory: (String) -> LogHandler = StdoutLogHandler.init
|
||||
fileprivate static var initialized = false
|
||||
|
||||
/// `bootstrap` is a one-time configuration function which globally selects the desired logging backend
|
||||
/// implementation. `bootstrap` can be called at maximum once in any given program, calling it more than once will
|
||||
/// lead to undefined behaviour, most likely a crash.
|
||||
///
|
||||
/// - parameters:
|
||||
/// - factory: A closure that given a `Logger` identifier, produces an instance of the `LogHandler`.
|
||||
public static func bootstrap(_ factory: @escaping (String) -> LogHandler) {
|
||||
lock.withWriterLock {
|
||||
precondition(!self.initialized, "logging system can only be initialized once per process.")
|
||||
self.factory = factory
|
||||
self.initialized = true
|
||||
}
|
||||
}
|
||||
|
||||
// for our testing we want to allow multiple bootstraping
|
||||
internal static func bootstrapInternal(_ factory: @escaping (String) -> LogHandler) {
|
||||
self.lock.withWriterLock {
|
||||
self.factory = factory
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Logger {
|
||||
/// `Metadata` is a typealias for `[String: Logger.MetadataValue]` the type of the metadata storage.
|
||||
public typealias Metadata = [String: MetadataValue]
|
||||
|
||||
/// A logging metadata value. `Logger.MetadataValue` is string, array, and dictionary literal convertible.
|
||||
public enum MetadataValue {
|
||||
/// A metadata value which is a `String`.
|
||||
case string(String)
|
||||
|
||||
/// A metadata value which is some `CustomStringConvertible`.
|
||||
case stringConvertible(CustomStringConvertible)
|
||||
|
||||
/// A metadata value which is a dictionary from `String` to `Logger.MetadataValue`.
|
||||
case dictionary(Metadata)
|
||||
|
||||
/// A metadata value which is an array of `Logger.MetadataValue`s.
|
||||
case array([Metadata.Value])
|
||||
}
|
||||
|
||||
/// The log level.
|
||||
///
|
||||
/// Raw values of log levels correspond to their severity, and are ordered by lowest numeric value (0) being
|
||||
/// the most severe. The raw values match the syslog values.
|
||||
public enum Level {
|
||||
/// Appropriate for messages that contain information only when debugging a program.
|
||||
case trace
|
||||
|
||||
/// Appropriate for messages that contain information normally of use only when
|
||||
/// debugging a program.
|
||||
case debug
|
||||
|
||||
/// Appropriate for informational messages.
|
||||
case info
|
||||
|
||||
/// Appropriate for conditions that are not error conditions, but that may require
|
||||
/// special handling.
|
||||
case notice
|
||||
|
||||
/// Appropriate for messages that are not error conditions, but more severe than
|
||||
/// `.notice`.
|
||||
case warning
|
||||
|
||||
/// Appropriate for error conditions.
|
||||
case error
|
||||
|
||||
/// Appropriate for criticial error conditions that usually require immediate
|
||||
/// attention.
|
||||
///
|
||||
/// When a `critical` message is logged, the logging backend (`LogHandler`) is free to perform
|
||||
/// more heavy-weight operations to capture system state (such as capturing stack traces) to facilitate
|
||||
/// debugging.
|
||||
case critical
|
||||
}
|
||||
|
||||
/// Construct a `Logger` given a `label` identifying the creator of the `Logger`.
|
||||
///
|
||||
/// The `label` should identify the creator of the `Logger`. This can be an application, a sub-system, or even
|
||||
/// a datatype.
|
||||
///
|
||||
/// - parameters:
|
||||
/// - label: An identifier for the creator of a `Logger`.
|
||||
public init(label: String) {
|
||||
self = LoggingSystem.lock.withReaderLock { Logger(label: label, LoggingSystem.factory(label)) }
|
||||
}
|
||||
|
||||
/// Construct a `Logger` given a `label` identifying the creator of the `Logger` or a non-standard `LogHandler`.
|
||||
///
|
||||
/// The `label` should identify the creator of the `Logger`. This can be an application, a sub-system, or even
|
||||
/// a datatype.
|
||||
///
|
||||
/// This initializer provides an escape hatch in case the global default logging backend implementation (set up
|
||||
/// using `LoggingSystem.bootstrap` is not appropriate for this particular logger.
|
||||
///
|
||||
/// - parameters:
|
||||
/// - label: An identifier for the creator of a `Logger`.
|
||||
/// - factory: A closure creating non-standard `LogHandler`s.
|
||||
public init(label: String, factory: (String) -> LogHandler) {
|
||||
self = Logger(label: label, factory(label))
|
||||
}
|
||||
}
|
||||
|
||||
extension Logger.Level {
|
||||
internal var naturalIntegralValue: Int {
|
||||
switch self {
|
||||
case .trace:
|
||||
return 0
|
||||
case .debug:
|
||||
return 1
|
||||
case .info:
|
||||
return 2
|
||||
case .notice:
|
||||
return 3
|
||||
case .warning:
|
||||
return 4
|
||||
case .error:
|
||||
return 5
|
||||
case .critical:
|
||||
return 6
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Logger.Level: Comparable {
|
||||
public static func < (lhs: Logger.Level, rhs: Logger.Level) -> Bool {
|
||||
return lhs.naturalIntegralValue < rhs.naturalIntegralValue
|
||||
}
|
||||
}
|
||||
|
||||
// Extension has to be done on explicit type rather than Logger.Metadata.Value as workaround for
|
||||
// https://bugs.swift.org/browse/SR-9687
|
||||
// Then we could write it as follows and it would work under Swift 5 and not only 4 as it does currently:
|
||||
// extension Logger.Metadata.Value: Equatable {
|
||||
extension Logger.MetadataValue: Equatable {
|
||||
public static func == (lhs: Logger.Metadata.Value, rhs: Logger.Metadata.Value) -> Bool {
|
||||
switch (lhs, rhs) {
|
||||
case (.string(let lhs), .string(let rhs)):
|
||||
return lhs == rhs
|
||||
case (.stringConvertible(let lhs), .stringConvertible(let rhs)):
|
||||
return lhs.description == rhs.description
|
||||
case (.array(let lhs), .array(let rhs)):
|
||||
return lhs == rhs
|
||||
case (.dictionary(let lhs), .dictionary(let rhs)):
|
||||
return lhs == rhs
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Logger {
|
||||
/// `Logger.Message` represents a log message's text. It is usually created using string literals.
|
||||
///
|
||||
/// Example creating a `Logger.Message`:
|
||||
///
|
||||
/// let world: String = "world"
|
||||
/// let myLogMessage: Logger.Message = "Hello \(world)"
|
||||
///
|
||||
/// Most commonly, `Logger.Message`s appear simply as the parameter to a logging method such as:
|
||||
///
|
||||
/// logger.info("Hello \(world)")
|
||||
///
|
||||
public struct Message: ExpressibleByStringLiteral,
|
||||
Equatable,
|
||||
CustomStringConvertible,
|
||||
ExpressibleByStringInterpolation {
|
||||
public typealias StringLiteralType = String
|
||||
|
||||
private var value: String
|
||||
|
||||
public init(stringLiteral value: String) {
|
||||
self.value = value
|
||||
}
|
||||
|
||||
public var description: String {
|
||||
return self.value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A pseudo-`LogHandler` that can be used to send messages to multiple other `LogHandler`s.
|
||||
///
|
||||
/// The first `LogHandler` passed to the initialisation function of `MultiplexLogHandler` control the `logLevel` as
|
||||
/// well as the `metadata` for this `LogHandler`. Any subsequent `LogHandler`s used to initialise a
|
||||
/// `MultiplexLogHandler` are merely to emit the log message to another place.
|
||||
public struct MultiplexLogHandler: LogHandler {
|
||||
private var handlers: [LogHandler]
|
||||
|
||||
public init(_ handlers: [LogHandler]) {
|
||||
assert(handlers.count > 0)
|
||||
self.handlers = handlers
|
||||
}
|
||||
|
||||
public var logLevel: Logger.Level {
|
||||
get {
|
||||
return self.handlers[0].logLevel
|
||||
}
|
||||
set {
|
||||
self.mutatingForEachHandler {
|
||||
$0.logLevel = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func log(level: Logger.Level,
|
||||
message: Logger.Message,
|
||||
metadata: Logger.Metadata?,
|
||||
file: String, function: String, line: UInt) {
|
||||
self.handlers.forEach { handler in
|
||||
handler.log(level: level, message: message, metadata: metadata, file: file, function: function, line: line)
|
||||
}
|
||||
}
|
||||
|
||||
public var metadata: Logger.Metadata {
|
||||
get {
|
||||
return self.handlers[0].metadata
|
||||
}
|
||||
set {
|
||||
self.mutatingForEachHandler { $0.metadata = newValue }
|
||||
}
|
||||
}
|
||||
|
||||
public subscript(metadataKey metadataKey: String) -> Logger.Metadata.Value? {
|
||||
get {
|
||||
return self.handlers[0].metadata[metadataKey]
|
||||
}
|
||||
set {
|
||||
self.mutatingForEachHandler { $0[metadataKey: metadataKey] = newValue }
|
||||
}
|
||||
}
|
||||
|
||||
private mutating func mutatingForEachHandler(_ mutator: (inout LogHandler) -> Void) {
|
||||
for index in self.handlers.indices {
|
||||
mutator(&self.handlers[index])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Ships with the logging module, really boring just prints something using the `print` function
|
||||
internal struct StdoutLogHandler: LogHandler {
|
||||
private let lock = Lock()
|
||||
|
||||
public init(label: String) {}
|
||||
|
||||
private var _logLevel: Logger.Level = .info
|
||||
|
||||
public var logLevel: Logger.Level {
|
||||
get {
|
||||
return self.lock.withLock { self._logLevel }
|
||||
}
|
||||
set {
|
||||
self.lock.withLock {
|
||||
self._logLevel = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var prettyMetadata: String?
|
||||
private var _metadata = Logger.Metadata() {
|
||||
didSet {
|
||||
self.prettyMetadata = self.prettify(self._metadata)
|
||||
}
|
||||
}
|
||||
|
||||
public func log(level: Logger.Level,
|
||||
message: Logger.Message,
|
||||
metadata: Logger.Metadata?,
|
||||
file: String, function: String, line: UInt) {
|
||||
let prettyMetadata = metadata?.isEmpty ?? true
|
||||
? self.prettyMetadata
|
||||
: self.prettify(self.metadata.merging(metadata!, uniquingKeysWith: { _, new in new }))
|
||||
print("\(self.timestamp()) \(level):\(prettyMetadata.map { " \($0)" } ?? "") \(message)")
|
||||
}
|
||||
|
||||
public var metadata: Logger.Metadata {
|
||||
get {
|
||||
return self.lock.withLock { self._metadata }
|
||||
}
|
||||
set {
|
||||
self.lock.withLock { self._metadata = newValue }
|
||||
}
|
||||
}
|
||||
|
||||
public subscript(metadataKey metadataKey: String) -> Logger.Metadata.Value? {
|
||||
get {
|
||||
return self.lock.withLock { self._metadata[metadataKey] }
|
||||
}
|
||||
set {
|
||||
self.lock.withLock {
|
||||
self._metadata[metadataKey] = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func prettify(_ metadata: Logger.Metadata) -> String? {
|
||||
return !metadata.isEmpty ? metadata.map { "\($0)=\($1)" }.joined(separator: " ") : nil
|
||||
}
|
||||
|
||||
private func timestamp() -> String {
|
||||
var buffer = [Int8](repeating: 0, count: 255)
|
||||
var timestamp = time(nil)
|
||||
let localTime = localtime(×tamp)
|
||||
strftime(&buffer, buffer.count, "%Y-%m-%dT%H:%M:%S%z", localTime)
|
||||
return buffer.withUnsafeBufferPointer {
|
||||
$0.withMemoryRebound(to: CChar.self) {
|
||||
String(cString: $0.baseAddress!)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Extension has to be done on explicit type rather than Logger.Metadata.Value as workaround for
|
||||
// https://bugs.swift.org/browse/SR-9687
|
||||
extension Logger.MetadataValue: ExpressibleByStringLiteral {
|
||||
public typealias StringLiteralType = String
|
||||
|
||||
public init(stringLiteral value: String) {
|
||||
self = .string(value)
|
||||
}
|
||||
}
|
||||
|
||||
extension Logger.MetadataValue: CustomStringConvertible {
|
||||
public var description: String {
|
||||
switch self {
|
||||
case .dictionary(let dict):
|
||||
return dict.mapValues { $0.description }.description
|
||||
case .array(let list):
|
||||
return list.map { $0.description }.description
|
||||
case .string(let str):
|
||||
return str
|
||||
case .stringConvertible(let repr):
|
||||
return repr.description
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Extension has to be done on explicit type rather than Logger.Metadata.Value as workaround for
|
||||
// https://bugs.swift.org/browse/SR-9687
|
||||
extension Logger.MetadataValue: ExpressibleByStringInterpolation {
|
||||
}
|
||||
|
||||
// Extension has to be done on explicit type rather than Logger.Metadata.Value as workaround for
|
||||
// https://bugs.swift.org/browse/SR-9687
|
||||
extension Logger.MetadataValue: ExpressibleByDictionaryLiteral {
|
||||
public typealias Key = String
|
||||
public typealias Value = Logger.Metadata.Value
|
||||
|
||||
public init(dictionaryLiteral elements: (String, Logger.Metadata.Value)...) {
|
||||
self = .dictionary(.init(uniqueKeysWithValues: elements))
|
||||
}
|
||||
}
|
||||
|
||||
// Extension has to be done on explicit type rather than Logger.Metadata.Value as workaround for
|
||||
// https://bugs.swift.org/browse/SR-9687
|
||||
extension Logger.MetadataValue: ExpressibleByArrayLiteral {
|
||||
public typealias ArrayLiteralElement = Logger.Metadata.Value
|
||||
|
||||
public init(arrayLiteral elements: Logger.Metadata.Value...) {
|
||||
self = .array(elements)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Logging API open source project
|
||||
//
|
||||
// Copyright (c) 2018-2019 Apple Inc. and the Swift Logging API project authors
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of Swift Logging API project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// LinuxMain.swift
|
||||
//
|
||||
import XCTest
|
||||
|
||||
///
|
||||
/// NOTE: This file was generated by generate_linux_tests.rb
|
||||
///
|
||||
/// Do NOT edit this file directly as it will be regenerated automatically when needed.
|
||||
///
|
||||
|
||||
#if os(Linux) || os(FreeBSD)
|
||||
@testable import LoggingTests
|
||||
|
||||
XCTMain([
|
||||
testCase(GlobalLoggerTest.allTests),
|
||||
testCase(LocalLoggerTest.allTests),
|
||||
testCase(LoggingTest.allTests),
|
||||
testCase(MDCTest.allTests),
|
||||
])
|
||||
#endif
|
||||
@@ -0,0 +1,35 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Logging API open source project
|
||||
//
|
||||
// Copyright (c) 2018-2019 Apple Inc. and the Swift Logging API project authors
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of Swift Logging API project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// GlobalLoggingTest+XCTest.swift
|
||||
//
|
||||
import XCTest
|
||||
|
||||
///
|
||||
/// NOTE: This file was generated by generate_linux_tests.rb
|
||||
///
|
||||
/// Do NOT edit this file directly as it will be regenerated automatically when needed.
|
||||
///
|
||||
|
||||
extension GlobalLoggerTest {
|
||||
|
||||
static var allTests : [(String, (GlobalLoggerTest) -> () throws -> Void)] {
|
||||
return [
|
||||
("test1", test1),
|
||||
("test2", test2),
|
||||
("test3", test3),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Logging API open source project
|
||||
//
|
||||
// Copyright (c) 2018-2019 Apple Inc. and the Swift Logging API project authors
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of Swift Logging API project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
@testable import Logging
|
||||
import XCTest
|
||||
|
||||
class GlobalLoggerTest: XCTestCase {
|
||||
func test1() throws {
|
||||
// bootstrap with our test logging impl
|
||||
let logging = TestLogging()
|
||||
LoggingSystem.bootstrapInternal(logging.make)
|
||||
|
||||
// change test logging config to log traces and above
|
||||
logging.config.set(value: Logger.Level.debug)
|
||||
// run our program
|
||||
Struct1().doSomething()
|
||||
// test results
|
||||
logging.history.assertExist(level: .debug, message: "Struct1::doSomething")
|
||||
logging.history.assertExist(level: .debug, message: "Struct1::doSomethingElse")
|
||||
logging.history.assertExist(level: .info, message: "Struct2::doSomething")
|
||||
logging.history.assertExist(level: .info, message: "Struct2::doSomethingElse")
|
||||
logging.history.assertExist(level: .error, message: "Struct3::doSomething")
|
||||
logging.history.assertExist(level: .error, message: "Struct3::doSomethingElse", metadata: ["foo": "bar"])
|
||||
logging.history.assertExist(level: .warning, message: "Struct3::doSomethingElseAsync", metadata: ["foo": "bar"])
|
||||
logging.history.assertExist(level: .info, message: "TestLibrary::doSomething", metadata: ["foo": "bar"])
|
||||
logging.history.assertExist(level: .info, message: "TestLibrary::doSomethingAsync", metadata: ["foo": "bar"])
|
||||
logging.history.assertExist(level: .debug, message: "Struct3::doSomethingElse::Local", metadata: ["baz": "qux"])
|
||||
logging.history.assertExist(level: .debug, message: "Struct3::doSomethingElse::end")
|
||||
logging.history.assertExist(level: .debug, message: "Struct3::doSomething::end")
|
||||
logging.history.assertExist(level: .debug, message: "Struct2::doSomethingElse::end")
|
||||
logging.history.assertExist(level: .debug, message: "Struct1::doSomethingElse::end")
|
||||
logging.history.assertExist(level: .debug, message: "Struct1::doSomething::end")
|
||||
}
|
||||
|
||||
func test2() throws {
|
||||
// bootstrap with our test logging impl
|
||||
let logging = TestLogging()
|
||||
LoggingSystem.bootstrapInternal(logging.make)
|
||||
|
||||
// change test logging config to log errors and above
|
||||
logging.config.set(value: Logger.Level.error)
|
||||
// run our program
|
||||
Struct1().doSomething()
|
||||
// test results
|
||||
logging.history.assertNotExist(level: .debug, message: "Struct1::doSomething")
|
||||
logging.history.assertNotExist(level: .debug, message: "Struct1::doSomethingElse")
|
||||
logging.history.assertNotExist(level: .info, message: "Struct2::doSomething")
|
||||
logging.history.assertNotExist(level: .info, message: "Struct2::doSomethingElse")
|
||||
logging.history.assertExist(level: .error, message: "Struct3::doSomething")
|
||||
logging.history.assertExist(level: .error, message: "Struct3::doSomethingElse", metadata: ["foo": "bar"])
|
||||
logging.history.assertNotExist(level: .warning, message: "Struct3::doSomethingElseAsync", metadata: ["foo": "bar"])
|
||||
logging.history.assertNotExist(level: .info, message: "TestLibrary::doSomething", metadata: ["foo": "bar"])
|
||||
logging.history.assertNotExist(level: .info, message: "TestLibrary::doSomethingAsync", metadata: ["foo": "bar"])
|
||||
logging.history.assertNotExist(level: .debug, message: "Struct3::doSomethingElse::Local", metadata: ["baz": "qux"])
|
||||
logging.history.assertNotExist(level: .debug, message: "Struct3::doSomethingElse::end")
|
||||
logging.history.assertNotExist(level: .debug, message: "Struct3::doSomething::end")
|
||||
logging.history.assertNotExist(level: .debug, message: "Struct2::doSomethingElse::end")
|
||||
logging.history.assertNotExist(level: .debug, message: "Struct1::doSomethingElse::end")
|
||||
logging.history.assertNotExist(level: .debug, message: "Struct1::doSomething::end")
|
||||
}
|
||||
|
||||
func test3() throws {
|
||||
// bootstrap with our test logging impl
|
||||
let logging = TestLogging()
|
||||
LoggingSystem.bootstrapInternal(logging.make)
|
||||
|
||||
// change test logging config
|
||||
logging.config.set(value: .warning)
|
||||
logging.config.set(key: "GlobalLoggerTest::Struct2", value: .info)
|
||||
logging.config.set(key: "TestLibrary", value: .debug)
|
||||
// run our program
|
||||
Struct1().doSomething()
|
||||
// test results
|
||||
logging.history.assertNotExist(level: .debug, message: "Struct1::doSomething")
|
||||
logging.history.assertNotExist(level: .debug, message: "Struct1::doSomethingElse")
|
||||
logging.history.assertExist(level: .info, message: "Struct2::doSomething")
|
||||
logging.history.assertExist(level: .info, message: "Struct2::doSomethingElse")
|
||||
logging.history.assertExist(level: .error, message: "Struct3::doSomething")
|
||||
logging.history.assertExist(level: .error, message: "Struct3::doSomethingElse", metadata: ["foo": "bar"])
|
||||
logging.history.assertExist(level: .warning, message: "Struct3::doSomethingElseAsync", metadata: ["foo": "bar"])
|
||||
logging.history.assertExist(level: .info, message: "TestLibrary::doSomething", metadata: ["foo": "bar"])
|
||||
logging.history.assertExist(level: .info, message: "TestLibrary::doSomethingAsync", metadata: ["foo": "bar"])
|
||||
logging.history.assertNotExist(level: .debug, message: "Struct3::doSomethingElse::Local", metadata: ["baz": "qux"])
|
||||
logging.history.assertNotExist(level: .debug, message: "Struct3::doSomethingElse::end")
|
||||
logging.history.assertNotExist(level: .debug, message: "Struct3::doSomething::end")
|
||||
logging.history.assertNotExist(level: .debug, message: "Struct2::doSomethingElse::end")
|
||||
logging.history.assertNotExist(level: .debug, message: "Struct1::doSomethingElse::end")
|
||||
logging.history.assertNotExist(level: .debug, message: "Struct1::doSomething::end")
|
||||
}
|
||||
}
|
||||
|
||||
private struct Struct1 {
|
||||
private let logger = Logger(label: "GlobalLoggerTest::Struct1")
|
||||
|
||||
func doSomething() {
|
||||
self.logger.debug("Struct1::doSomething")
|
||||
self.doSomethingElse()
|
||||
self.logger.debug("Struct1::doSomething::end")
|
||||
}
|
||||
|
||||
private func doSomethingElse() {
|
||||
self.logger.debug("Struct1::doSomethingElse")
|
||||
Struct2().doSomething()
|
||||
self.logger.debug("Struct1::doSomethingElse::end")
|
||||
}
|
||||
}
|
||||
|
||||
private struct Struct2 {
|
||||
let logger = Logger(label: "GlobalLoggerTest::Struct2")
|
||||
|
||||
func doSomething() {
|
||||
self.logger.info("Struct2::doSomething")
|
||||
self.doSomethingElse()
|
||||
self.logger.debug("Struct2::doSomething::end")
|
||||
}
|
||||
|
||||
private func doSomethingElse() {
|
||||
self.logger.info("Struct2::doSomethingElse")
|
||||
Struct3().doSomething()
|
||||
self.logger.debug("Struct2::doSomethingElse::end")
|
||||
}
|
||||
}
|
||||
|
||||
private struct Struct3 {
|
||||
private let logger = Logger(label: "GlobalLoggerTest::Struct3")
|
||||
private let queue = DispatchQueue(label: "GlobalLoggerTest::Struct3")
|
||||
|
||||
func doSomething() {
|
||||
self.logger.error("Struct3::doSomething")
|
||||
self.doSomethingElse()
|
||||
self.logger.debug("Struct3::doSomething::end")
|
||||
}
|
||||
|
||||
private func doSomethingElse() {
|
||||
MDC.global["foo"] = "bar"
|
||||
self.logger.error("Struct3::doSomethingElse")
|
||||
let group = DispatchGroup()
|
||||
group.enter()
|
||||
let loggingMetadata = MDC.global.metadata
|
||||
queue.async {
|
||||
MDC.global.with(metadata: loggingMetadata) {
|
||||
self.logger.warning("Struct3::doSomethingElseAsync")
|
||||
let library = TestLibrary()
|
||||
library.doSomething()
|
||||
library.doSomethingAsync {
|
||||
group.leave()
|
||||
}
|
||||
}
|
||||
}
|
||||
group.wait()
|
||||
MDC.global["foo"] = nil
|
||||
// only effects the logger instance
|
||||
var l = logger
|
||||
l[metadataKey: "baz"] = "qux"
|
||||
l.debug("Struct3::doSomethingElse::Local")
|
||||
logger.debug("Struct3::doSomethingElse::end")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Logging API open source project
|
||||
//
|
||||
// Copyright (c) 2018-2019 Apple Inc. and the Swift Logging API project authors
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of Swift Logging API project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// LocalLoggingTest+XCTest.swift
|
||||
//
|
||||
import XCTest
|
||||
|
||||
///
|
||||
/// NOTE: This file was generated by generate_linux_tests.rb
|
||||
///
|
||||
/// Do NOT edit this file directly as it will be regenerated automatically when needed.
|
||||
///
|
||||
|
||||
extension LocalLoggerTest {
|
||||
|
||||
static var allTests : [(String, (LocalLoggerTest) -> () throws -> Void)] {
|
||||
return [
|
||||
("test1", test1),
|
||||
("test2", test2),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Logging API open source project
|
||||
//
|
||||
// Copyright (c) 2018-2019 Apple Inc. and the Swift Logging API project authors
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of Swift Logging API project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
@testable import Logging
|
||||
import XCTest
|
||||
|
||||
class LocalLoggerTest: XCTestCase {
|
||||
func test1() throws {
|
||||
// bootstrap with our test logging impl
|
||||
let logging = TestLogging()
|
||||
LoggingSystem.bootstrapInternal(logging.make)
|
||||
|
||||
// change test logging config to log traces and above
|
||||
logging.config.set(value: Logger.Level.debug)
|
||||
// run our program
|
||||
let context = Context()
|
||||
Struct1().doSomething(context: context)
|
||||
// test results
|
||||
logging.history.assertExist(level: .debug, message: "Struct1::doSomething")
|
||||
logging.history.assertNotExist(level: .debug, message: "Struct1::doSomethingElse")
|
||||
logging.history.assertExist(level: .info, message: "Struct2::doSomething")
|
||||
logging.history.assertExist(level: .info, message: "Struct2::doSomethingElse")
|
||||
logging.history.assertExist(level: .error, message: "Struct3::doSomething", metadata: ["bar": "baz"])
|
||||
logging.history.assertExist(level: .error, message: "Struct3::doSomethingElse", metadata: ["bar": "baz"])
|
||||
logging.history.assertExist(level: .warning, message: "Struct3::doSomethingElseAsync", metadata: ["bar": "baz"])
|
||||
logging.history.assertExist(level: .info, message: "TestLibrary::doSomething")
|
||||
logging.history.assertExist(level: .info, message: "TestLibrary::doSomethingAsync")
|
||||
logging.history.assertExist(level: .debug, message: "Struct3::doSomethingElse::Local", metadata: ["bar": "baz", "baz": "qux"])
|
||||
logging.history.assertExist(level: .debug, message: "Struct3::doSomethingElse::end", metadata: ["bar": "baz"])
|
||||
logging.history.assertExist(level: .debug, message: "Struct3::doSomething::end", metadata: ["bar": "baz"])
|
||||
logging.history.assertExist(level: .debug, message: "Struct2::doSomethingElse::end")
|
||||
logging.history.assertExist(level: .debug, message: "Struct1::doSomethingElse::end")
|
||||
logging.history.assertExist(level: .debug, message: "Struct1::doSomething::end")
|
||||
}
|
||||
|
||||
func test2() throws {
|
||||
// bootstrap with our test logging impl
|
||||
let logging = TestLogging()
|
||||
LoggingSystem.bootstrapInternal(logging.make)
|
||||
|
||||
// change test logging config to log errors and above
|
||||
logging.config.set(value: Logger.Level.error)
|
||||
// run our program
|
||||
let context = Context()
|
||||
Struct1().doSomething(context: context)
|
||||
// test results
|
||||
logging.history.assertNotExist(level: .debug, message: "Struct1::doSomething") // global context
|
||||
logging.history.assertNotExist(level: .debug, message: "Struct1::doSomethingElse") // global context
|
||||
logging.history.assertExist(level: .info, message: "Struct2::doSomething") // local context
|
||||
logging.history.assertExist(level: .info, message: "Struct2::doSomethingElse") // local context
|
||||
logging.history.assertExist(level: .error, message: "Struct3::doSomething", metadata: ["bar": "baz"]) // local context
|
||||
logging.history.assertExist(level: .error, message: "Struct3::doSomethingElse", metadata: ["bar": "baz"]) // local context
|
||||
logging.history.assertExist(level: .warning, message: "Struct3::doSomethingElseAsync", metadata: ["bar": "baz"]) // local context
|
||||
logging.history.assertNotExist(level: .info, message: "TestLibrary::doSomething") // global context
|
||||
logging.history.assertNotExist(level: .info, message: "TestLibrary::doSomethingAsync") // global context
|
||||
logging.history.assertExist(level: .debug, message: "Struct3::doSomethingElse::Local", metadata: ["bar": "baz", "baz": "qux"]) // hyper local context
|
||||
logging.history.assertExist(level: .debug, message: "Struct3::doSomethingElse::end", metadata: ["bar": "baz"]) // local context
|
||||
logging.history.assertExist(level: .debug, message: "Struct3::doSomething::end", metadata: ["bar": "baz"]) // local context
|
||||
logging.history.assertExist(level: .debug, message: "Struct2::doSomethingElse::end") // local context
|
||||
logging.history.assertNotExist(level: .debug, message: "Struct1::doSomethingElse::end") // global context
|
||||
logging.history.assertNotExist(level: .debug, message: "Struct1::doSomething::end") // global context
|
||||
}
|
||||
}
|
||||
|
||||
// systems that follow the context pattern need to implement something like this
|
||||
private struct Context {
|
||||
var logger = Logger(label: "LocalLoggerTest::ContextLogger")
|
||||
|
||||
// since logger is a value type, we can reuse our copy to manage logLevel
|
||||
var logLevel: Logger.Level {
|
||||
get { return self.logger.logLevel }
|
||||
set { self.logger.logLevel = newValue }
|
||||
}
|
||||
|
||||
// since logger is a value type, we can reuse our copy to manage metadata
|
||||
subscript(metadataKey: String) -> Logger.Metadata.Value? {
|
||||
get { return self.logger[metadataKey: metadataKey] }
|
||||
set { self.logger[metadataKey: metadataKey] = newValue }
|
||||
}
|
||||
}
|
||||
|
||||
private struct Struct1 {
|
||||
func doSomething(context: Context) {
|
||||
context.logger.debug("Struct1::doSomething")
|
||||
self.doSomethingElse(context: context)
|
||||
context.logger.debug("Struct1::doSomething::end")
|
||||
}
|
||||
|
||||
private func doSomethingElse(context: Context) {
|
||||
let originalContext = context
|
||||
var context = context
|
||||
context.logger.logLevel = .warning
|
||||
context.logger.debug("Struct1::doSomethingElse")
|
||||
Struct2().doSomething(context: context)
|
||||
originalContext.logger.debug("Struct1::doSomethingElse::end")
|
||||
}
|
||||
}
|
||||
|
||||
private struct Struct2 {
|
||||
func doSomething(context: Context) {
|
||||
var c = context
|
||||
c.logLevel = .info // only effects from this point on
|
||||
c.logger.info("Struct2::doSomething")
|
||||
doSomethingElse(context: c)
|
||||
c.logger.debug("Struct2::doSomething::end")
|
||||
}
|
||||
|
||||
private func doSomethingElse(context: Context) {
|
||||
var c = context
|
||||
c.logLevel = .debug // only effects from this point on
|
||||
c.logger.info("Struct2::doSomethingElse")
|
||||
Struct3().doSomething(context: c)
|
||||
c.logger.debug("Struct2::doSomethingElse::end")
|
||||
}
|
||||
}
|
||||
|
||||
private struct Struct3 {
|
||||
private let queue = DispatchQueue(label: "LocalLoggerTest::Struct3")
|
||||
|
||||
func doSomething(context: Context) {
|
||||
var c = context
|
||||
c["bar"] = "baz" // only effects from this point on
|
||||
c.logger.error("Struct3::doSomething")
|
||||
doSomethingElse(context: c)
|
||||
c.logger.debug("Struct3::doSomething::end")
|
||||
}
|
||||
|
||||
private func doSomethingElse(context: Context) {
|
||||
context.logger.error("Struct3::doSomethingElse")
|
||||
let group = DispatchGroup()
|
||||
group.enter()
|
||||
queue.async {
|
||||
context.logger.warning("Struct3::doSomethingElseAsync")
|
||||
let library = TestLibrary()
|
||||
library.doSomething()
|
||||
library.doSomethingAsync {
|
||||
group.leave()
|
||||
}
|
||||
}
|
||||
group.wait()
|
||||
// only effects the logger instance
|
||||
var l = context.logger
|
||||
l[metadataKey: "baz"] = "qux"
|
||||
l.debug("Struct3::doSomethingElse::Local")
|
||||
context.logger.debug("Struct3::doSomethingElse::end")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Logging API open source project
|
||||
//
|
||||
// Copyright (c) 2018-2019 Apple Inc. and the Swift Logging API project authors
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of Swift Logging API project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// LoggingTest+XCTest.swift
|
||||
//
|
||||
import XCTest
|
||||
|
||||
///
|
||||
/// NOTE: This file was generated by generate_linux_tests.rb
|
||||
///
|
||||
/// Do NOT edit this file directly as it will be regenerated automatically when needed.
|
||||
///
|
||||
|
||||
extension LoggingTest {
|
||||
|
||||
static var allTests : [(String, (LoggingTest) -> () throws -> Void)] {
|
||||
return [
|
||||
("testAutoclosure", testAutoclosure),
|
||||
("testMultiplex", testMultiplex),
|
||||
("testDictionaryMetadata", testDictionaryMetadata),
|
||||
("testListMetadata", testListMetadata),
|
||||
("testStringConvertibleMetadata", testStringConvertibleMetadata),
|
||||
("testAutoClosuresAreNotForcedUnlessNeeded", testAutoClosuresAreNotForcedUnlessNeeded),
|
||||
("testLocalMetadata", testLocalMetadata),
|
||||
("testCustomFactory", testCustomFactory),
|
||||
("testAllLogLevelsExceptCriticalCanBeBlocked", testAllLogLevelsExceptCriticalCanBeBlocked),
|
||||
("testAllLogLevelsWork", testAllLogLevelsWork),
|
||||
("testLogMessageWithStringInterpolation", testLogMessageWithStringInterpolation),
|
||||
("testLoggingAString", testLoggingAString),
|
||||
("testMultiplexerIsValue", testMultiplexerIsValue),
|
||||
("testLoggerWithGlobalOverride", testLoggerWithGlobalOverride),
|
||||
("testLogLevelOrdering", testLogLevelOrdering),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,415 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Logging API open source project
|
||||
//
|
||||
// Copyright (c) 2018-2019 Apple Inc. and the Swift Logging API project authors
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of Swift Logging API project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
@testable import Logging
|
||||
import XCTest
|
||||
|
||||
class LoggingTest: XCTestCase {
|
||||
func testAutoclosure() throws {
|
||||
// bootstrap with our test logging impl
|
||||
let logging = TestLogging()
|
||||
LoggingSystem.bootstrapInternal(logging.make)
|
||||
|
||||
var logger = Logger(label: "test")
|
||||
logger.logLevel = .info
|
||||
logger.log(level: .debug, {
|
||||
XCTFail("trace should not be called")
|
||||
return "trace"
|
||||
}())
|
||||
logger.debug({
|
||||
XCTFail("trace should not be called")
|
||||
return "trace"
|
||||
}())
|
||||
logger.debug({
|
||||
XCTFail("debug should not be called")
|
||||
return "debug"
|
||||
}())
|
||||
logger.info({
|
||||
"info"
|
||||
}())
|
||||
logger.warning({
|
||||
"warning"
|
||||
}())
|
||||
logger.error({
|
||||
"error"
|
||||
}())
|
||||
XCTAssertEqual(3, logging.history.entries.count, "expected number of entries to match")
|
||||
logging.history.assertNotExist(level: .debug, message: "trace")
|
||||
logging.history.assertNotExist(level: .debug, message: "debug")
|
||||
logging.history.assertExist(level: .info, message: "info")
|
||||
logging.history.assertExist(level: .warning, message: "warning")
|
||||
logging.history.assertExist(level: .error, message: "error")
|
||||
}
|
||||
|
||||
func testMultiplex() throws {
|
||||
// bootstrap with our test logging impl
|
||||
let logging1 = TestLogging()
|
||||
let logging2 = TestLogging()
|
||||
LoggingSystem.bootstrapInternal({ MultiplexLogHandler([logging1.make(label: $0), logging2.make(label: $0)]) })
|
||||
|
||||
var logger = Logger(label: "test")
|
||||
logger.logLevel = .warning
|
||||
logger.info("hello world?")
|
||||
logger[metadataKey: "foo"] = "bar"
|
||||
logger.warning("hello world!")
|
||||
logging1.history.assertNotExist(level: .info, message: "hello world?")
|
||||
logging2.history.assertNotExist(level: .info, message: "hello world?")
|
||||
logging1.history.assertExist(level: .warning, message: "hello world!", metadata: ["foo": "bar"])
|
||||
logging2.history.assertExist(level: .warning, message: "hello world!", metadata: ["foo": "bar"])
|
||||
}
|
||||
|
||||
enum TestError: Error {
|
||||
case boom
|
||||
}
|
||||
|
||||
func testDictionaryMetadata() {
|
||||
let testLogging = TestLogging()
|
||||
LoggingSystem.bootstrapInternal(testLogging.make)
|
||||
|
||||
var logger = Logger(label: "\(#function)")
|
||||
logger[metadataKey: "foo"] = ["bar": "buz"]
|
||||
logger[metadataKey: "empty-dict"] = [:]
|
||||
logger[metadataKey: "nested-dict"] = ["l1key": ["l2key": ["l3key": "l3value"]]]
|
||||
logger.info("hello world!")
|
||||
testLogging.history.assertExist(level: .info,
|
||||
message: "hello world!",
|
||||
metadata: ["foo": ["bar": "buz"],
|
||||
"empty-dict": [:],
|
||||
"nested-dict": ["l1key": ["l2key": ["l3key": "l3value"]]]])
|
||||
}
|
||||
|
||||
func testListMetadata() {
|
||||
let testLogging = TestLogging()
|
||||
LoggingSystem.bootstrapInternal(testLogging.make)
|
||||
|
||||
var logger = Logger(label: "\(#function)")
|
||||
logger[metadataKey: "foo"] = ["bar", "buz"]
|
||||
logger[metadataKey: "empty-list"] = []
|
||||
logger[metadataKey: "nested-list"] = ["l1str", ["l2str1", "l2str2"]]
|
||||
logger.info("hello world!")
|
||||
testLogging.history.assertExist(level: .info,
|
||||
message: "hello world!",
|
||||
metadata: ["foo": ["bar", "buz"],
|
||||
"empty-list": [],
|
||||
"nested-list": ["l1str", ["l2str1", "l2str2"]]])
|
||||
}
|
||||
|
||||
// Example of custom "box" which may be used to implement "render at most once" semantics
|
||||
// Not thread-safe, thus should not be shared across threads.
|
||||
internal class LazyMetadataBox: CustomStringConvertible {
|
||||
private var makeValue: (() -> String)?
|
||||
private var _value: String? = nil
|
||||
|
||||
public init(_ makeValue: @escaping () -> String) {
|
||||
self.makeValue = makeValue
|
||||
}
|
||||
|
||||
/// This allows caching a value in case it is accessed via an by name subscript,
|
||||
// rather than as part of rendering all metadata that a LoggingContext was carrying
|
||||
public var value: String {
|
||||
if let f = self.makeValue {
|
||||
self._value = f()
|
||||
self.makeValue = nil
|
||||
}
|
||||
|
||||
assert(self._value != nil, "_value MUST NOT be nil once `lazyValue` has run.")
|
||||
return self._value!
|
||||
}
|
||||
|
||||
public var description: String {
|
||||
return "\(self.value)"
|
||||
}
|
||||
}
|
||||
|
||||
func testStringConvertibleMetadata() {
|
||||
let testLogging = TestLogging()
|
||||
LoggingSystem.bootstrapInternal(testLogging.make)
|
||||
var logger = Logger(label: "\(#function)")
|
||||
|
||||
logger[metadataKey: "foo"] = .stringConvertible("raw-string")
|
||||
let lazyBox = LazyMetadataBox({ "rendered-at-first-use" })
|
||||
logger[metadataKey: "lazy"] = .stringConvertible(lazyBox)
|
||||
logger.info("hello world!")
|
||||
testLogging.history.assertExist(level: .info,
|
||||
message: "hello world!",
|
||||
metadata: ["foo": .stringConvertible("raw-string"),
|
||||
"lazy": .stringConvertible(LazyMetadataBox({ "rendered-at-first-use" }))])
|
||||
}
|
||||
|
||||
private func dontEvaluateThisString(file: StaticString = #file, line: UInt = #line) -> Logger.Message {
|
||||
XCTFail("should not have been evaluated", file: file, line: line)
|
||||
return "should not have been evaluated"
|
||||
}
|
||||
|
||||
func testAutoClosuresAreNotForcedUnlessNeeded() {
|
||||
let testLogging = TestLogging()
|
||||
LoggingSystem.bootstrapInternal(testLogging.make)
|
||||
|
||||
var logger = Logger(label: "\(#function)")
|
||||
logger.logLevel = .error
|
||||
|
||||
logger.debug(self.dontEvaluateThisString(), metadata: ["foo": "\(self.dontEvaluateThisString())"])
|
||||
logger.debug(self.dontEvaluateThisString())
|
||||
logger.info(self.dontEvaluateThisString())
|
||||
logger.warning(self.dontEvaluateThisString())
|
||||
logger.log(level: .warning, self.dontEvaluateThisString())
|
||||
}
|
||||
|
||||
func testLocalMetadata() {
|
||||
let testLogging = TestLogging()
|
||||
LoggingSystem.bootstrapInternal(testLogging.make)
|
||||
|
||||
var logger = Logger(label: "\(#function)")
|
||||
logger.info("hello world!", metadata: ["foo": "bar"])
|
||||
logger[metadataKey: "bar"] = "baz"
|
||||
logger[metadataKey: "baz"] = "qux"
|
||||
logger.warning("hello world!")
|
||||
logger.error("hello world!", metadata: ["baz": "quc"])
|
||||
testLogging.history.assertExist(level: .info, message: "hello world!", metadata: ["foo": "bar"])
|
||||
testLogging.history.assertExist(level: .warning, message: "hello world!", metadata: ["bar": "baz", "baz": "qux"])
|
||||
testLogging.history.assertExist(level: .error, message: "hello world!", metadata: ["bar": "baz", "baz": "quc"])
|
||||
}
|
||||
|
||||
func testCustomFactory() {
|
||||
struct CustomHandler: LogHandler {
|
||||
func log(level: Logger.Level, message: Logger.Message, metadata: Logger.Metadata?, file: String, function: String, line: UInt) {}
|
||||
|
||||
subscript(metadataKey _: String) -> Logger.Metadata.Value? {
|
||||
get { return nil }
|
||||
set {}
|
||||
}
|
||||
|
||||
var metadata: Logger.Metadata {
|
||||
get { return Logger.Metadata() }
|
||||
set {}
|
||||
}
|
||||
|
||||
var logLevel: Logger.Level {
|
||||
get { return .info }
|
||||
set {}
|
||||
}
|
||||
}
|
||||
|
||||
let logger1 = Logger(label: "foo")
|
||||
XCTAssertFalse(logger1.handler is CustomHandler, "expected non-custom log handler")
|
||||
let logger2 = Logger(label: "foo", factory: { _ in CustomHandler() })
|
||||
XCTAssertTrue(logger2.handler is CustomHandler, "expected custom log handler")
|
||||
}
|
||||
|
||||
func testAllLogLevelsExceptCriticalCanBeBlocked() {
|
||||
let testLogging = TestLogging()
|
||||
LoggingSystem.bootstrapInternal(testLogging.make)
|
||||
|
||||
var logger = Logger(label: "\(#function)")
|
||||
logger.logLevel = .critical
|
||||
|
||||
logger.trace("no")
|
||||
logger.debug("no")
|
||||
logger.info("no")
|
||||
logger.notice("no")
|
||||
logger.warning("no")
|
||||
logger.error("no")
|
||||
logger.critical("yes: critical")
|
||||
|
||||
testLogging.history.assertNotExist(level: .trace, message: "no")
|
||||
testLogging.history.assertNotExist(level: .debug, message: "no")
|
||||
testLogging.history.assertNotExist(level: .info, message: "no")
|
||||
testLogging.history.assertNotExist(level: .notice, message: "no")
|
||||
testLogging.history.assertNotExist(level: .warning, message: "no")
|
||||
testLogging.history.assertNotExist(level: .error, message: "no")
|
||||
testLogging.history.assertExist(level: .critical, message: "yes: critical")
|
||||
}
|
||||
|
||||
func testAllLogLevelsWork() {
|
||||
let testLogging = TestLogging()
|
||||
LoggingSystem.bootstrapInternal(testLogging.make)
|
||||
|
||||
var logger = Logger(label: "\(#function)")
|
||||
logger.logLevel = .trace
|
||||
|
||||
logger.trace("yes: trace")
|
||||
logger.debug("yes: debug")
|
||||
logger.info("yes: info")
|
||||
logger.notice("yes: notice")
|
||||
logger.warning("yes: warning")
|
||||
logger.error("yes: error")
|
||||
logger.critical("yes: critical")
|
||||
|
||||
testLogging.history.assertExist(level: .trace, message: "yes: trace")
|
||||
testLogging.history.assertExist(level: .debug, message: "yes: debug")
|
||||
testLogging.history.assertExist(level: .info, message: "yes: info")
|
||||
testLogging.history.assertExist(level: .notice, message: "yes: notice")
|
||||
testLogging.history.assertExist(level: .warning, message: "yes: warning")
|
||||
testLogging.history.assertExist(level: .error, message: "yes: error")
|
||||
testLogging.history.assertExist(level: .critical, message: "yes: critical")
|
||||
}
|
||||
|
||||
func testLogMessageWithStringInterpolation() {
|
||||
let testLogging = TestLogging()
|
||||
LoggingSystem.bootstrapInternal(testLogging.make)
|
||||
|
||||
var logger = Logger(label: "\(#function)")
|
||||
logger.logLevel = .debug
|
||||
|
||||
let someInt = Int.random(in: 23..<42)
|
||||
logger.debug("My favourite number is \(someInt) and not \(someInt - 1)")
|
||||
testLogging.history.assertExist(level: .debug,
|
||||
message: "My favourite number is \(someInt) and not \(someInt - 1)" as String)
|
||||
}
|
||||
|
||||
func testLoggingAString() {
|
||||
let testLogging = TestLogging()
|
||||
LoggingSystem.bootstrapInternal(testLogging.make)
|
||||
|
||||
var logger = Logger(label: "\(#function)")
|
||||
logger.logLevel = .debug
|
||||
|
||||
let anActualString: String = "hello world!"
|
||||
// We can't stick an actual String in here because we expect a Logger.Message. If we want to log an existing
|
||||
// `String`, we can use string interpolation. The error you'll get trying to use the String directly is:
|
||||
//
|
||||
// error: Cannot convert value of type 'String' to expected argument type 'Logger.Message'
|
||||
logger.debug("\(anActualString)")
|
||||
testLogging.history.assertExist(level: .debug, message: "hello world!")
|
||||
}
|
||||
|
||||
func testMultiplexerIsValue() {
|
||||
let multi = MultiplexLogHandler([StdoutLogHandler(label: "x"), StdoutLogHandler(label: "y")])
|
||||
LoggingSystem.bootstrapInternal { _ in
|
||||
print("new multi")
|
||||
return multi
|
||||
}
|
||||
var logger1: Logger = {
|
||||
var logger = Logger(label: "foo")
|
||||
logger.logLevel = .debug
|
||||
logger[metadataKey: "only-on"] = "first"
|
||||
return logger
|
||||
}()
|
||||
XCTAssertEqual(.debug, logger1.logLevel)
|
||||
var logger2 = logger1
|
||||
logger2.logLevel = .error
|
||||
logger2[metadataKey: "only-on"] = "second"
|
||||
XCTAssertEqual(.error, logger2.logLevel)
|
||||
XCTAssertEqual(.debug, logger1.logLevel)
|
||||
XCTAssertEqual("first", logger1[metadataKey: "only-on"])
|
||||
XCTAssertEqual("second", logger2[metadataKey: "only-on"])
|
||||
logger1.error("hey")
|
||||
}
|
||||
|
||||
func testLoggerWithGlobalOverride() {
|
||||
struct LogHandlerWithGlobalLogLevelOverride: LogHandler {
|
||||
// the static properties hold the globally overridden log level (if overridden)
|
||||
private static let overrideLock = Lock()
|
||||
private static var overrideLogLevel: Logger.Level? = nil
|
||||
|
||||
private let recorder: Recorder
|
||||
// this holds the log level if not overridden
|
||||
private var _logLevel: Logger.Level = .info
|
||||
|
||||
// metadata storage
|
||||
var metadata: Logger.Metadata = [:]
|
||||
|
||||
init(recorder: Recorder) {
|
||||
self.recorder = recorder
|
||||
}
|
||||
|
||||
var logLevel: Logger.Level {
|
||||
// when we get asked for the log level, we check if it was globally overridden or not
|
||||
get {
|
||||
return LogHandlerWithGlobalLogLevelOverride.overrideLock.withLock {
|
||||
return LogHandlerWithGlobalLogLevelOverride.overrideLogLevel
|
||||
} ?? self._logLevel
|
||||
}
|
||||
// we set the log level whenever we're asked (note: this might not have an effect if globally
|
||||
// overridden)
|
||||
set {
|
||||
self._logLevel = newValue
|
||||
}
|
||||
}
|
||||
|
||||
func log(level: Logger.Level, message: Logger.Message, metadata: Logger.Metadata?,
|
||||
file: String, function: String, line: UInt) {
|
||||
self.recorder.record(level: level, metadata: metadata, message: message)
|
||||
}
|
||||
|
||||
subscript(metadataKey metadataKey: String) -> Logger.Metadata.Value? {
|
||||
get {
|
||||
return self.metadata[metadataKey]
|
||||
}
|
||||
set(newValue) {
|
||||
self.metadata[metadataKey] = newValue
|
||||
}
|
||||
}
|
||||
|
||||
// this is the function to globally override the log level, it is not part of the `LogHandler` protocol
|
||||
static func overrideGlobalLogLevel(_ logLevel: Logger.Level) {
|
||||
LogHandlerWithGlobalLogLevelOverride.overrideLock.withLock {
|
||||
LogHandlerWithGlobalLogLevelOverride.overrideLogLevel = logLevel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let logRecorder = Recorder()
|
||||
LoggingSystem.bootstrapInternal { _ in
|
||||
return LogHandlerWithGlobalLogLevelOverride(recorder: logRecorder)
|
||||
}
|
||||
|
||||
var logger1 = Logger(label: "logger-\(#file):\(#line)")
|
||||
var logger2 = logger1
|
||||
logger1.logLevel = .warning
|
||||
logger1[metadataKey: "only-on"] = "first"
|
||||
logger2.logLevel = .error
|
||||
logger2[metadataKey: "only-on"] = "second"
|
||||
XCTAssertEqual(.error, logger2.logLevel)
|
||||
XCTAssertEqual(.warning, logger1.logLevel)
|
||||
XCTAssertEqual("first", logger1[metadataKey: "only-on"])
|
||||
XCTAssertEqual("second", logger2[metadataKey: "only-on"])
|
||||
|
||||
logger1.notice("logger1, before")
|
||||
logger2.notice("logger2, before")
|
||||
|
||||
LogHandlerWithGlobalLogLevelOverride.overrideGlobalLogLevel(.debug)
|
||||
|
||||
logger1.notice("logger1, after")
|
||||
logger2.notice("logger2, after")
|
||||
|
||||
logRecorder.assertNotExist(level: .notice, message: "logger1, before")
|
||||
logRecorder.assertNotExist(level: .notice, message: "logger2, before")
|
||||
logRecorder.assertExist(level: .notice, message: "logger1, after")
|
||||
logRecorder.assertExist(level: .notice, message: "logger2, after")
|
||||
}
|
||||
|
||||
func testLogLevelOrdering() {
|
||||
XCTAssertLessThan(Logger.Level.trace, Logger.Level.debug)
|
||||
XCTAssertLessThan(Logger.Level.trace, Logger.Level.info)
|
||||
XCTAssertLessThan(Logger.Level.trace, Logger.Level.notice)
|
||||
XCTAssertLessThan(Logger.Level.trace, Logger.Level.warning)
|
||||
XCTAssertLessThan(Logger.Level.trace, Logger.Level.error)
|
||||
XCTAssertLessThan(Logger.Level.trace, Logger.Level.critical)
|
||||
XCTAssertLessThan(Logger.Level.debug, Logger.Level.info)
|
||||
XCTAssertLessThan(Logger.Level.debug, Logger.Level.notice)
|
||||
XCTAssertLessThan(Logger.Level.debug, Logger.Level.warning)
|
||||
XCTAssertLessThan(Logger.Level.debug, Logger.Level.error)
|
||||
XCTAssertLessThan(Logger.Level.debug, Logger.Level.critical)
|
||||
XCTAssertLessThan(Logger.Level.info, Logger.Level.notice)
|
||||
XCTAssertLessThan(Logger.Level.info, Logger.Level.warning)
|
||||
XCTAssertLessThan(Logger.Level.info, Logger.Level.error)
|
||||
XCTAssertLessThan(Logger.Level.info, Logger.Level.critical)
|
||||
XCTAssertLessThan(Logger.Level.notice, Logger.Level.warning)
|
||||
XCTAssertLessThan(Logger.Level.notice, Logger.Level.error)
|
||||
XCTAssertLessThan(Logger.Level.notice, Logger.Level.critical)
|
||||
XCTAssertLessThan(Logger.Level.warning, Logger.Level.error)
|
||||
XCTAssertLessThan(Logger.Level.warning, Logger.Level.critical)
|
||||
XCTAssertLessThan(Logger.Level.error, Logger.Level.critical)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Logging API open source project
|
||||
//
|
||||
// Copyright (c) 2018-2019 Apple Inc. and the Swift Logging API project authors
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of Swift Logging API project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// MDCTest+XCTest.swift
|
||||
//
|
||||
import XCTest
|
||||
|
||||
///
|
||||
/// NOTE: This file was generated by generate_linux_tests.rb
|
||||
///
|
||||
/// Do NOT edit this file directly as it will be regenerated automatically when needed.
|
||||
///
|
||||
|
||||
extension MDCTest {
|
||||
|
||||
static var allTests : [(String, (MDCTest) -> () throws -> Void)] {
|
||||
return [
|
||||
("test1", test1),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Logging API open source project
|
||||
//
|
||||
// Copyright (c) 2018-2019 Apple Inc. and the Swift Logging API project authors
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of Swift Logging API project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
import Dispatch
|
||||
@testable import Logging
|
||||
import XCTest
|
||||
|
||||
class MDCTest: XCTestCase {
|
||||
func test1() throws {
|
||||
// bootstrap with our test logger
|
||||
let logging = TestLogging()
|
||||
LoggingSystem.bootstrapInternal(logging.make)
|
||||
|
||||
// run the program
|
||||
MDC.global["foo"] = "bar"
|
||||
let group = DispatchGroup()
|
||||
for r in 5 ... 10 {
|
||||
group.enter()
|
||||
DispatchQueue(label: "mdc-test-queue-\(r)").async {
|
||||
let add = Int.random(in: 10 ... 1000)
|
||||
let remove = Int.random(in: 0 ... add - 1)
|
||||
for i in 0 ... add {
|
||||
MDC.global["key-\(i)"] = "value-\(i)"
|
||||
}
|
||||
for i in 0 ... remove {
|
||||
MDC.global["key-\(i)"] = nil
|
||||
}
|
||||
XCTAssertEqual(add - remove, MDC.global.metadata.count, "expected number of entries to match")
|
||||
for i in remove + 1 ... add {
|
||||
XCTAssertNotNil(MDC.global["key-\(i)"], "expecting value for key-\(i)")
|
||||
}
|
||||
for i in 0 ... remove {
|
||||
XCTAssertNil(MDC.global["key-\(i)"], "not expecting value for key-\(i)")
|
||||
}
|
||||
MDC.global.clear()
|
||||
group.leave()
|
||||
}
|
||||
}
|
||||
group.wait()
|
||||
XCTAssertEqual(MDC.global["foo"], "bar", "expecting to find top items")
|
||||
MDC.global["foo"] = nil
|
||||
XCTAssertTrue(MDC.global.metadata.isEmpty, "MDC should be empty")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,294 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Logging API open source project
|
||||
//
|
||||
// Copyright (c) 2018-2019 Apple Inc. and the Swift Logging API project authors
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of Swift Logging API project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
import Foundation
|
||||
@testable import Logging
|
||||
import XCTest
|
||||
|
||||
internal struct TestLogging {
|
||||
private let _config = Config() // shared among loggers
|
||||
private let recorder = Recorder() // shared among loggers
|
||||
|
||||
func make(label: String) -> LogHandler {
|
||||
return TestLogHandler(label: label, config: self.config, recorder: self.recorder)
|
||||
}
|
||||
|
||||
var config: Config { return self._config }
|
||||
var history: History { return self.recorder }
|
||||
}
|
||||
|
||||
internal struct TestLogHandler: LogHandler {
|
||||
private let logLevelLock = NSLock()
|
||||
private let metadataLock = NSLock()
|
||||
private let recorder: Recorder
|
||||
private let config: Config
|
||||
private var logger: Logger // the actual logger
|
||||
|
||||
let label: String
|
||||
init(label: String, config: Config, recorder: Recorder) {
|
||||
self.label = label
|
||||
self.config = config
|
||||
self.recorder = recorder
|
||||
self.logger = Logger(label: "test", StdoutLogHandler(label: label))
|
||||
self.logger.logLevel = .debug
|
||||
}
|
||||
|
||||
func log(level: Logger.Level, message: Logger.Message, metadata: Logger.Metadata?, file: String, function: String, line: UInt) {
|
||||
let metadata = (self._metadataSet ? self.metadata : MDC.global.metadata).merging(metadata ?? [:], uniquingKeysWith: { _, new in new })
|
||||
logger.log(level: level, message, metadata: metadata, file: file, function: function, line: line)
|
||||
self.recorder.record(level: level, metadata: metadata, message: message)
|
||||
}
|
||||
|
||||
private var _logLevel: Logger.Level?
|
||||
var logLevel: Logger.Level {
|
||||
get {
|
||||
// get from config unless set
|
||||
return self.logLevelLock.withLock { self._logLevel } ?? self.config.get(key: self.label)
|
||||
}
|
||||
set {
|
||||
self.logLevelLock.withLock { self._logLevel = newValue }
|
||||
}
|
||||
}
|
||||
|
||||
private var _metadataSet = false
|
||||
private var _metadata = Logger.Metadata() {
|
||||
didSet {
|
||||
self._metadataSet = true
|
||||
}
|
||||
}
|
||||
|
||||
public var metadata: Logger.Metadata {
|
||||
get {
|
||||
// return self.logger.metadata
|
||||
return self.metadataLock.withLock { self._metadata }
|
||||
}
|
||||
set {
|
||||
// self.logger.metadata = newValue
|
||||
self.metadataLock.withLock { self._metadata = newValue }
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: would be nice to delegate to local copy of logger but StdoutLogger is a reference type. why?
|
||||
subscript(metadataKey metadataKey: Logger.Metadata.Key) -> Logger.Metadata.Value? {
|
||||
get {
|
||||
// return self.logger[metadataKey: metadataKey]
|
||||
return self.metadataLock.withLock { self._metadata[metadataKey] }
|
||||
}
|
||||
set {
|
||||
// return logger[metadataKey: metadataKey] = newValue
|
||||
self.metadataLock.withLock {
|
||||
self._metadata[metadataKey] = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class Config {
|
||||
private static let ALL = "*"
|
||||
|
||||
private let lock = NSLock()
|
||||
private var storage = [String: Logger.Level]()
|
||||
|
||||
func get(key: String) -> Logger.Level {
|
||||
return self.get(key) ?? self.get(Config.ALL) ?? Logger.Level.debug
|
||||
}
|
||||
|
||||
func get(_ key: String) -> Logger.Level? {
|
||||
guard let value = (self.lock.withLock { self.storage[key] }) else {
|
||||
return nil
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
func set(key: String = Config.ALL, value: Logger.Level) {
|
||||
self.lock.withLock { self.storage[key] = value }
|
||||
}
|
||||
|
||||
func clear() {
|
||||
self.lock.withLock { self.storage.removeAll() }
|
||||
}
|
||||
}
|
||||
|
||||
internal class Recorder: History {
|
||||
private let lock = NSLock()
|
||||
private var _entries = [LogEntry]()
|
||||
|
||||
func record(level: Logger.Level, metadata: Logger.Metadata?, message: Logger.Message) {
|
||||
return self.lock.withLock {
|
||||
self._entries.append(LogEntry(level: level, metadata: metadata, message: message.description))
|
||||
}
|
||||
}
|
||||
|
||||
var entries: [LogEntry] {
|
||||
return self.lock.withLock { self._entries }
|
||||
}
|
||||
}
|
||||
|
||||
internal protocol History {
|
||||
var entries: [LogEntry] { get }
|
||||
}
|
||||
|
||||
internal extension History {
|
||||
func atLevel(level: Logger.Level) -> [LogEntry] {
|
||||
return self.entries.filter { entry in
|
||||
level == entry.level
|
||||
}
|
||||
}
|
||||
|
||||
var trace: [LogEntry] {
|
||||
return self.atLevel(level: .debug)
|
||||
}
|
||||
|
||||
var debug: [LogEntry] {
|
||||
return self.atLevel(level: .debug)
|
||||
}
|
||||
|
||||
var info: [LogEntry] {
|
||||
return self.atLevel(level: .info)
|
||||
}
|
||||
|
||||
var warning: [LogEntry] {
|
||||
return self.atLevel(level: .warning)
|
||||
}
|
||||
|
||||
var error: [LogEntry] {
|
||||
return self.atLevel(level: .error)
|
||||
}
|
||||
}
|
||||
|
||||
internal struct LogEntry {
|
||||
let level: Logger.Level
|
||||
let metadata: Logger.Metadata?
|
||||
let message: String
|
||||
}
|
||||
|
||||
extension History {
|
||||
func assertExist(level: Logger.Level, message: String, metadata: Logger.Metadata? = nil, file: StaticString = #file, line: UInt = #line) {
|
||||
let entry = self.find(level: level, message: message, metadata: metadata)
|
||||
XCTAssertNotNil(entry, "entry not found: \(level), \(String(describing: metadata)), \(message) ", file: file, line: line)
|
||||
}
|
||||
|
||||
func assertNotExist(level: Logger.Level, message: String, metadata: Logger.Metadata? = nil, file: StaticString = #file, line: UInt = #line) {
|
||||
let entry = self.find(level: level, message: message, metadata: metadata)
|
||||
XCTAssertNil(entry, "entry was found: \(level), \(String(describing: metadata)), \(message)", file: file, line: line)
|
||||
}
|
||||
|
||||
func find(level: Logger.Level, message: String, metadata: Logger.Metadata? = nil) -> LogEntry? {
|
||||
return self.entries.first { entry in
|
||||
entry.level == level &&
|
||||
entry.message == message &&
|
||||
entry.metadata ?? [:] == metadata ?? [:]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MDC {
|
||||
private let lock = NSLock()
|
||||
private var storage = [Int: Logger.Metadata]()
|
||||
|
||||
public static var global = MDC()
|
||||
|
||||
private init() {}
|
||||
|
||||
public subscript(metadataKey: String) -> Logger.Metadata.Value? {
|
||||
get {
|
||||
return self.lock.withLock {
|
||||
self.storage[self.threadId]?[metadataKey]
|
||||
}
|
||||
}
|
||||
set {
|
||||
self.lock.withLock {
|
||||
if nil == self.storage[self.threadId] {
|
||||
self.storage[self.threadId] = Logger.Metadata()
|
||||
}
|
||||
self.storage[self.threadId]![metadataKey] = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public var metadata: Logger.Metadata {
|
||||
return self.lock.withLock {
|
||||
self.storage[self.threadId] ?? [:]
|
||||
}
|
||||
}
|
||||
|
||||
public func clear() {
|
||||
self.lock.withLock {
|
||||
_ = self.storage.removeValue(forKey: self.threadId)
|
||||
}
|
||||
}
|
||||
|
||||
public func with(metadata: Logger.Metadata, _ body: () throws -> Void) rethrows {
|
||||
metadata.forEach { self[$0] = $1 }
|
||||
defer {
|
||||
metadata.keys.forEach { self[$0] = nil }
|
||||
}
|
||||
try body()
|
||||
}
|
||||
|
||||
public func with<T>(metadata: Logger.Metadata, _ body: () throws -> T) rethrows -> T {
|
||||
metadata.forEach { self[$0] = $1 }
|
||||
defer {
|
||||
metadata.keys.forEach { self[$0] = nil }
|
||||
}
|
||||
return try body()
|
||||
}
|
||||
|
||||
// for testing
|
||||
internal func flush() {
|
||||
self.lock.withLock {
|
||||
self.storage.removeAll()
|
||||
}
|
||||
}
|
||||
|
||||
private var threadId: Int {
|
||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
||||
return Int(pthread_mach_thread_np(pthread_self()))
|
||||
#else
|
||||
return Int(pthread_self())
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
internal extension NSLock {
|
||||
func withLock<T>(_ body: () -> T) -> T {
|
||||
self.lock()
|
||||
defer {
|
||||
self.unlock()
|
||||
}
|
||||
return body()
|
||||
}
|
||||
}
|
||||
|
||||
internal struct TestLibrary {
|
||||
private let logger = Logger(label: "TestLibrary")
|
||||
private let queue = DispatchQueue(label: "TestLibrary")
|
||||
|
||||
public init() {}
|
||||
|
||||
public func doSomething() {
|
||||
self.logger.info("TestLibrary::doSomething")
|
||||
}
|
||||
|
||||
public func doSomethingAsync(completion: @escaping () -> Void) {
|
||||
// libraries that use global loggers and async, need to make sure they propagate the
|
||||
// logging metadata when creating a new thread
|
||||
let metadata = MDC.global.metadata
|
||||
queue.asyncAfter(deadline: .now() + 0.1) {
|
||||
MDC.global.with(metadata: metadata) {
|
||||
self.logger.info("TestLibrary::doSomethingAsync")
|
||||
completion()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
ARG ubuntu_version=18.04
|
||||
FROM ubuntu:$ubuntu_version
|
||||
# needed to do again after FROM due to docker limitation
|
||||
ARG ubuntu_version
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
# do not start services during installation as this will fail and log a warning / error.
|
||||
RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d
|
||||
|
||||
# basic dependencies
|
||||
RUN apt-get update && apt-get install -y wget git build-essential software-properties-common pkg-config locales
|
||||
RUN apt-get update && apt-get install -y libicu-dev libblocksruntime0 curl libcurl4-openssl-dev libz-dev
|
||||
|
||||
# local
|
||||
RUN locale-gen en_US.UTF-8
|
||||
RUN locale-gen en_US en_US.UTF-8
|
||||
RUN dpkg-reconfigure locales
|
||||
RUN echo 'export LANG=en_US.UTF-8' >> $HOME/.profile
|
||||
RUN echo 'export LANGUAGE=en_US:en' >> $HOME/.profile
|
||||
RUN echo 'export LC_ALL=en_US.UTF-8' >> $HOME/.profile
|
||||
|
||||
# known_hosts
|
||||
RUN mkdir -p $HOME/.ssh
|
||||
RUN touch $HOME/.ssh/known_hosts
|
||||
RUN ssh-keyscan github.com 2> /dev/null >> $HOME/.ssh/known_hosts
|
||||
|
||||
# clang
|
||||
RUN apt-get update && apt-get install -y clang-3.9
|
||||
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.9 100
|
||||
RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.9 100
|
||||
|
||||
# ruby and jazzy for docs generation
|
||||
#ARG skip_ruby_from_ppa
|
||||
#RUN [ -n "$skip_ruby_from_ppa" ] || apt-add-repository -y ppa:brightbox/ruby-ng
|
||||
#RUN [ -n "$skip_ruby_from_ppa" ] || { apt-get update && apt-get install -y ruby2.4 ruby2.4-dev; }
|
||||
#RUN [ -z "$skip_ruby_from_ppa" ] || { apt-get update && apt-get install -y ruby ruby-dev; }
|
||||
#RUN apt-get update && apt-get install -y libsqlite3-dev
|
||||
RUN apt-get update && apt-get install -y ruby ruby-dev libsqlite3-dev
|
||||
RUN gem install jazzy --no-ri --no-rdoc
|
||||
|
||||
# swift
|
||||
ARG swift_version=4.2.3
|
||||
ARG swift_flavour=RELEASE
|
||||
ARG swift_builds_suffix=release
|
||||
|
||||
RUN mkdir $HOME/.swift
|
||||
RUN wget -q "https://swift.org/builds/swift-${swift_version}-${swift_builds_suffix}/ubuntu$(echo $ubuntu_version | sed 's/\.//g')/swift-${swift_version}-${swift_flavour}/swift-${swift_version}-${swift_flavour}-ubuntu${ubuntu_version}.tar.gz" -O $HOME/swift.tar.gz
|
||||
RUN tar xzf $HOME/swift.tar.gz --directory $HOME/.swift --strip-components=1
|
||||
RUN echo 'export PATH="$HOME/.swift/usr/bin:$PATH"' >> $HOME/.profile
|
||||
RUN echo 'export LINUX_SOURCEKIT_LIB_PATH="$HOME/.swift/usr/lib"' >> $HOME/.profile
|
||||
|
||||
# script to allow mapping framepointers on linux
|
||||
RUN mkdir -p $HOME/.scripts
|
||||
RUN wget -q https://raw.githubusercontent.com/apple/swift/master/utils/symbolicate-linux-fatal -O $HOME/.scripts/symbolicate-linux-fatal
|
||||
RUN chmod 755 $HOME/.scripts/symbolicate-linux-fatal
|
||||
RUN echo 'export PATH="$HOME/.scripts:$PATH"' >> $HOME/.profile
|
||||
@@ -0,0 +1,15 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
|
||||
runtime-setup:
|
||||
image: swift-log:18.04-5.0
|
||||
build:
|
||||
args:
|
||||
ubuntu_version: "18.04"
|
||||
swift_version: "5.0"
|
||||
swift_flavour: "DEVELOPMENT-SNAPSHOT-2019-03-06-a"
|
||||
swift_builds_suffix: "branch"
|
||||
|
||||
test:
|
||||
image: swift-log:18.04-5.0
|
||||
@@ -0,0 +1,28 @@
|
||||
# this file is not designed to be run directly
|
||||
# instead, use the docker-compose.<os>.<swift> files
|
||||
# eg docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.1804.50.yaml run test
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
|
||||
runtime-setup:
|
||||
image: swift-log:default
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
|
||||
common: &common
|
||||
image: swift-log:default
|
||||
depends_on: [runtime-setup]
|
||||
volumes:
|
||||
- ~/.ssh:/root/.ssh
|
||||
- ..:/code
|
||||
working_dir: /code
|
||||
|
||||
sanity:
|
||||
<<: *common
|
||||
command: /bin/bash -cl "./scripts/sanity.sh"
|
||||
|
||||
test:
|
||||
<<: *common
|
||||
command: /bin/bash -cl "swift test"
|
||||
@@ -1,154 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Enumerations Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="js/jquery.min.js" defer></script>
|
||||
<script src="js/jazzy.js" defer></script>
|
||||
|
||||
<script src="js/lunr.min.js" defer></script>
|
||||
<script src="js/typeahead.jquery.js" defer></script>
|
||||
<script src="js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Section/Enumerations" class="dashAnchor"></a>
|
||||
|
||||
<a title="Enumerations Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="index.html">
|
||||
Logging Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="index.html">Logging Reference</a>
|
||||
<img class="carat" src="img/carat.png" />
|
||||
Enumerations Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>Enumerations</h1>
|
||||
<p>The following enumerations are available globally.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging0A6SystemO"></a>
|
||||
<a name="//apple_ref/swift/Enum/LoggingSystem" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging0A6SystemO">LoggingSystem</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>The <code>LoggingSystem</code> is a global facility where the default logging backend implementation (<code><a href="Protocols/LogHandler.html">LogHandler</a></code>) can be
|
||||
configured. <code>LoggingSystem</code> is set up just once in a given program to set up the desired logging backend
|
||||
implementation.</p>
|
||||
|
||||
<a href="Enums/LoggingSystem.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">LoggingSystem</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L259-L284">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2019 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external">SwiftLog team</a>. All rights reserved. (Last updated: 2019-09-30)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.10.0</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,180 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>LoggingSystem Enumeration Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../js/jquery.min.js" defer></script>
|
||||
<script src="../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../js/lunr.min.js" defer></script>
|
||||
<script src="../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Enum/LoggingSystem" class="dashAnchor"></a>
|
||||
|
||||
<a title="LoggingSystem Enumeration Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
Logging Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">Logging Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
LoggingSystem Enumeration Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>LoggingSystem</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">LoggingSystem</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>The <code>LoggingSystem</code> is a global facility where the default logging backend implementation (<code><a href="../Protocols/LogHandler.html">LogHandler</a></code>) can be
|
||||
configured. <code>LoggingSystem</code> is set up just once in a given program to set up the desired logging backend
|
||||
implementation.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging0A6SystemO9bootstrapyyAA10LogHandler_pSScFZ"></a>
|
||||
<a name="//apple_ref/swift/Method/bootstrap(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging0A6SystemO9bootstrapyyAA10LogHandler_pSScFZ">bootstrap(_:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p><code>bootstrap</code> is a one-time configuration function which globally selects the desired logging backend
|
||||
implementation. <code>bootstrap</code> can be called at maximum once in any given program, calling it more than once will
|
||||
lead to undefined behaviour, most likely a crash.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="nf">bootstrap</span><span class="p">(</span><span class="n">_</span> <span class="nv">factory</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt"><a href="../Protocols/LogHandler.html">LogHandler</a></span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>factory</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>A closure that given a <code><a href="../Structs/Logger.html">Logger</a></code> identifier, produces an instance of the <code><a href="../Protocols/LogHandler.html">LogHandler</a></code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L270-L276">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2019 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external">SwiftLog team</a>. All rights reserved. (Last updated: 2019-09-30)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.10.0</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,245 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Protocols Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="js/jquery.min.js" defer></script>
|
||||
<script src="js/jazzy.js" defer></script>
|
||||
|
||||
<script src="js/lunr.min.js" defer></script>
|
||||
<script src="js/typeahead.jquery.js" defer></script>
|
||||
<script src="js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Section/Protocols" class="dashAnchor"></a>
|
||||
|
||||
<a title="Protocols Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="index.html">
|
||||
Logging Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="index.html">Logging Reference</a>
|
||||
<img class="carat" src="img/carat.png" />
|
||||
Protocols Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>Protocols</h1>
|
||||
<p>The following protocols are available globally.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP"></a>
|
||||
<a name="//apple_ref/swift/Protocol/LogHandler" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP">LogHandler</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>A <code>LogHandler</code> is an implementation of a logging backend.</p>
|
||||
|
||||
<p>This type is an implementation detail and should not normally be used, unless implementing your own logging backend.
|
||||
To use the SwiftLog API, please refer to the documentation of <code><a href="Structs/Logger.html">Logger</a></code>.</p>
|
||||
<h1 id='implementation-requirements' class='heading'>Implementation requirements</h1>
|
||||
|
||||
<p>To implement your own <code>LogHandler</code> you should respect a few requirements that are necessary so applications work
|
||||
as expected regardless of the selected <code>LogHandler</code> implementation.</p>
|
||||
|
||||
<ul>
|
||||
<li>The <code>LogHandler</code> must be a <code>struct</code>.</li>
|
||||
<li>The metadata and <code>logLevel</code> properties must be implemented so that setting them on a <code><a href="Structs/Logger.html">Logger</a></code> does not affect
|
||||
other <code><a href="Structs/Logger.html">Logger</a></code>s.</li>
|
||||
</ul>
|
||||
<h3 id='treat-log-level-amp-metadata-as-values' class='heading'>Treat log level & metadata as values</h3>
|
||||
|
||||
<p>When developing your <code>LogHandler</code>, please make sure the following test works.</p>
|
||||
<pre class="highlight swift"><code><span class="kt">LoggingSystem</span><span class="o">.</span><span class="nf">bootstrap</span><span class="p">(</span><span class="kt">MyLogHandler</span><span class="o">.</span><span class="kd">init</span><span class="p">)</span> <span class="c1">// your LogHandler might have a different bootstrapping step</span>
|
||||
<span class="k">var</span> <span class="nv">logger1</span> <span class="o">=</span> <span class="kt">Logger</span><span class="p">(</span><span class="nv">label</span><span class="p">:</span> <span class="s">"first logger"</span><span class="p">)</span>
|
||||
<span class="n">logger1</span><span class="o">.</span><span class="n">logLevel</span> <span class="o">=</span> <span class="o">.</span><span class="n">debug</span>
|
||||
<span class="n">logger1</span><span class="p">[</span><span class="nv">metadataKey</span><span class="p">:</span> <span class="s">"only-on"</span><span class="p">]</span> <span class="o">=</span> <span class="s">"first"</span>
|
||||
|
||||
<span class="k">var</span> <span class="nv">logger2</span> <span class="o">=</span> <span class="n">logger1</span>
|
||||
<span class="n">logger2</span><span class="o">.</span><span class="n">logLevel</span> <span class="o">=</span> <span class="o">.</span><span class="n">error</span> <span class="c1">// this must not override `logger1`'s log level</span>
|
||||
<span class="n">logger2</span><span class="p">[</span><span class="nv">metadataKey</span><span class="p">:</span> <span class="s">"only-on"</span><span class="p">]</span> <span class="o">=</span> <span class="s">"second"</span> <span class="c1">// this must not override `logger1`'s metadata</span>
|
||||
|
||||
<span class="kt">XCTAssertEqual</span><span class="p">(</span><span class="o">.</span><span class="n">debug</span><span class="p">,</span> <span class="n">logger1</span><span class="o">.</span><span class="n">logLevel</span><span class="p">)</span>
|
||||
<span class="kt">XCTAssertEqual</span><span class="p">(</span><span class="o">.</span><span class="n">error</span><span class="p">,</span> <span class="n">logger2</span><span class="o">.</span><span class="n">logLevel</span><span class="p">)</span>
|
||||
<span class="kt">XCTAssertEqual</span><span class="p">(</span><span class="s">"first"</span><span class="p">,</span> <span class="n">logger1</span><span class="p">[</span><span class="nv">metadataKey</span><span class="p">:</span> <span class="s">"only-on"</span><span class="p">])</span>
|
||||
<span class="kt">XCTAssertEqual</span><span class="p">(</span><span class="s">"second"</span><span class="p">,</span> <span class="n">logger2</span><span class="p">[</span><span class="nv">metadataKey</span><span class="p">:</span> <span class="s">"only-on"</span><span class="p">])</span>
|
||||
</code></pre>
|
||||
<h3 id='special-cases' class='heading'>Special cases</h3>
|
||||
|
||||
<p>In certain special cases, the log level behaving like a value on <code><a href="Structs/Logger.html">Logger</a></code> might not be what you want. For example,
|
||||
you might want to set the log level across <em>all</em> <code><a href="Structs/Logger.html">Logger</a></code>s to <code>.debug</code> when say a signal (eg. <code>SIGUSR1</code>) is received
|
||||
to be able to debug special failures in production. This special case is acceptable but we urge you to create a
|
||||
solution specific to your <code>LogHandler</code> implementation to achieve that. Please find an example implementation of this
|
||||
behavior below, on reception of the signal you would call
|
||||
<code>LogHandlerWithGlobalLogLevelOverride.overrideGlobalLogLevel = .debug</code>, for example.</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="p">:</span> <span class="kt">LogHandler</span> <span class="p">{</span>
|
||||
<span class="c1">// the static properties hold the globally overridden log level (if overridden)</span>
|
||||
<span class="kd">private</span> <span class="kd">static</span> <span class="k">let</span> <span class="nv">overrideLock</span> <span class="o">=</span> <span class="kt">Lock</span><span class="p">()</span>
|
||||
<span class="kd">private</span> <span class="kd">static</span> <span class="k">var</span> <span class="nv">overrideLogLevel</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span>
|
||||
|
||||
<span class="c1">// this holds the log level if not overridden</span>
|
||||
<span class="kd">private</span> <span class="k">var</span> <span class="nv">_logLevel</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span> <span class="o">=</span> <span class="o">.</span><span class="n">info</span>
|
||||
|
||||
<span class="c1">// metadata storage</span>
|
||||
<span class="kd">public</span> <span class="k">var</span> <span class="nv">metadata</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Metadata</span> <span class="o">=</span> <span class="p">[:]</span>
|
||||
|
||||
<span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">label</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="p">{</span>
|
||||
<span class="c1">// [...]</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="kd">public</span> <span class="k">var</span> <span class="nv">logLevel</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span> <span class="p">{</span>
|
||||
<span class="c1">// when we get asked for the log level, we check if it was globally overridden or not</span>
|
||||
<span class="k">get</span> <span class="p">{</span>
|
||||
<span class="k">return</span> <span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLock</span><span class="o">.</span><span class="n">withLock</span> <span class="p">{</span>
|
||||
<span class="k">return</span> <span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLogLevel</span>
|
||||
<span class="p">}</span> <span class="p">??</span> <span class="k">self</span><span class="o">.</span><span class="n">_logLevel</span>
|
||||
<span class="p">}</span>
|
||||
<span class="c1">// we set the log level whenever we're asked (note: this might not have an effect if globally</span>
|
||||
<span class="c1">// overridden)</span>
|
||||
<span class="k">set</span> <span class="p">{</span>
|
||||
<span class="k">self</span><span class="o">.</span><span class="n">_logLevel</span> <span class="o">=</span> <span class="n">newValue</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">log</span><span class="p">(</span><span class="nv">level</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span><span class="p">,</span> <span class="nv">message</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Message</span><span class="p">,</span> <span class="nv">metadata</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Metadata</span><span class="p">?,</span>
|
||||
<span class="nv">file</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">function</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">line</span><span class="p">:</span> <span class="kt">UInt</span><span class="p">)</span> <span class="p">{</span>
|
||||
<span class="c1">// [...]</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="kd">public</span> <span class="nf">subscript</span><span class="p">(</span><span class="n">metadataKey</span> <span class="nv">metadataKey</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Metadata</span><span class="o">.</span><span class="kt">Value</span><span class="p">?</span> <span class="p">{</span>
|
||||
<span class="k">get</span> <span class="p">{</span>
|
||||
<span class="k">return</span> <span class="k">self</span><span class="o">.</span><span class="n">metadata</span><span class="p">[</span><span class="n">metadataKey</span><span class="p">]</span>
|
||||
<span class="p">}</span>
|
||||
<span class="nf">set</span><span class="p">(</span><span class="n">newValue</span><span class="p">)</span> <span class="p">{</span>
|
||||
<span class="k">self</span><span class="o">.</span><span class="n">metadata</span><span class="p">[</span><span class="n">metadataKey</span><span class="p">]</span> <span class="o">=</span> <span class="n">newValue</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="c1">// this is the function to globally override the log level, it is not part of the `LogHandler` protocol</span>
|
||||
<span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="nf">overrideGlobalLogLevel</span><span class="p">(</span><span class="n">_</span> <span class="nv">logLevel</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span><span class="p">)</span> <span class="p">{</span>
|
||||
<span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLock</span><span class="o">.</span><span class="n">withLock</span> <span class="p">{</span>
|
||||
<span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLogLevel</span> <span class="o">=</span> <span class="n">logLevel</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre>
|
||||
|
||||
<p>Please note that the above <code>LogHandler</code> will still pass the ‘log level is a value’ test above it iff the global log
|
||||
level has not been overridden. And most importantly it passes the requirement listed above: A change to the log
|
||||
level on one <code><a href="Structs/Logger.html">Logger</a></code> should not affect the log level of another <code><a href="Structs/Logger.html">Logger</a></code> variable.</p>
|
||||
|
||||
<a href="Protocols/LogHandler.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">LogHandler</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/LogHandler.swift#L114-L153">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2019 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external">SwiftLog team</a>. All rights reserved. (Last updated: 2019-09-30)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.10.0</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,460 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>LogHandler Protocol Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../js/jquery.min.js" defer></script>
|
||||
<script src="../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../js/lunr.min.js" defer></script>
|
||||
<script src="../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Protocol/LogHandler" class="dashAnchor"></a>
|
||||
|
||||
<a title="LogHandler Protocol Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
Logging Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">Logging Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
LogHandler Protocol Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>LogHandler</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">LogHandler</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>A <code>LogHandler</code> is an implementation of a logging backend.</p>
|
||||
|
||||
<p>This type is an implementation detail and should not normally be used, unless implementing your own logging backend.
|
||||
To use the SwiftLog API, please refer to the documentation of <code><a href="../Structs/Logger.html">Logger</a></code>.</p>
|
||||
<h1 id='implementation-requirements' class='heading'>Implementation requirements</h1>
|
||||
|
||||
<p>To implement your own <code>LogHandler</code> you should respect a few requirements that are necessary so applications work
|
||||
as expected regardless of the selected <code>LogHandler</code> implementation.</p>
|
||||
|
||||
<ul>
|
||||
<li>The <code>LogHandler</code> must be a <code>struct</code>.</li>
|
||||
<li>The metadata and <code>logLevel</code> properties must be implemented so that setting them on a <code><a href="../Structs/Logger.html">Logger</a></code> does not affect
|
||||
other <code><a href="../Structs/Logger.html">Logger</a></code>s.</li>
|
||||
</ul>
|
||||
<h3 id='treat-log-level-amp-metadata-as-values' class='heading'>Treat log level & metadata as values</h3>
|
||||
|
||||
<p>When developing your <code>LogHandler</code>, please make sure the following test works.</p>
|
||||
<pre class="highlight swift"><code><span class="kt">LoggingSystem</span><span class="o">.</span><span class="nf">bootstrap</span><span class="p">(</span><span class="kt">MyLogHandler</span><span class="o">.</span><span class="kd">init</span><span class="p">)</span> <span class="c1">// your LogHandler might have a different bootstrapping step</span>
|
||||
<span class="k">var</span> <span class="nv">logger1</span> <span class="o">=</span> <span class="kt">Logger</span><span class="p">(</span><span class="nv">label</span><span class="p">:</span> <span class="s">"first logger"</span><span class="p">)</span>
|
||||
<span class="n">logger1</span><span class="o">.</span><span class="n">logLevel</span> <span class="o">=</span> <span class="o">.</span><span class="n">debug</span>
|
||||
<span class="n">logger1</span><span class="p">[</span><span class="nv">metadataKey</span><span class="p">:</span> <span class="s">"only-on"</span><span class="p">]</span> <span class="o">=</span> <span class="s">"first"</span>
|
||||
|
||||
<span class="k">var</span> <span class="nv">logger2</span> <span class="o">=</span> <span class="n">logger1</span>
|
||||
<span class="n">logger2</span><span class="o">.</span><span class="n">logLevel</span> <span class="o">=</span> <span class="o">.</span><span class="n">error</span> <span class="c1">// this must not override `logger1`'s log level</span>
|
||||
<span class="n">logger2</span><span class="p">[</span><span class="nv">metadataKey</span><span class="p">:</span> <span class="s">"only-on"</span><span class="p">]</span> <span class="o">=</span> <span class="s">"second"</span> <span class="c1">// this must not override `logger1`'s metadata</span>
|
||||
|
||||
<span class="kt">XCTAssertEqual</span><span class="p">(</span><span class="o">.</span><span class="n">debug</span><span class="p">,</span> <span class="n">logger1</span><span class="o">.</span><span class="n">logLevel</span><span class="p">)</span>
|
||||
<span class="kt">XCTAssertEqual</span><span class="p">(</span><span class="o">.</span><span class="n">error</span><span class="p">,</span> <span class="n">logger2</span><span class="o">.</span><span class="n">logLevel</span><span class="p">)</span>
|
||||
<span class="kt">XCTAssertEqual</span><span class="p">(</span><span class="s">"first"</span><span class="p">,</span> <span class="n">logger1</span><span class="p">[</span><span class="nv">metadataKey</span><span class="p">:</span> <span class="s">"only-on"</span><span class="p">])</span>
|
||||
<span class="kt">XCTAssertEqual</span><span class="p">(</span><span class="s">"second"</span><span class="p">,</span> <span class="n">logger2</span><span class="p">[</span><span class="nv">metadataKey</span><span class="p">:</span> <span class="s">"only-on"</span><span class="p">])</span>
|
||||
</code></pre>
|
||||
<h3 id='special-cases' class='heading'>Special cases</h3>
|
||||
|
||||
<p>In certain special cases, the log level behaving like a value on <code><a href="../Structs/Logger.html">Logger</a></code> might not be what you want. For example,
|
||||
you might want to set the log level across <em>all</em> <code><a href="../Structs/Logger.html">Logger</a></code>s to <code>.debug</code> when say a signal (eg. <code>SIGUSR1</code>) is received
|
||||
to be able to debug special failures in production. This special case is acceptable but we urge you to create a
|
||||
solution specific to your <code>LogHandler</code> implementation to achieve that. Please find an example implementation of this
|
||||
behavior below, on reception of the signal you would call
|
||||
<code>LogHandlerWithGlobalLogLevelOverride.overrideGlobalLogLevel = .debug</code>, for example.</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="p">:</span> <span class="kt">LogHandler</span> <span class="p">{</span>
|
||||
<span class="c1">// the static properties hold the globally overridden log level (if overridden)</span>
|
||||
<span class="kd">private</span> <span class="kd">static</span> <span class="k">let</span> <span class="nv">overrideLock</span> <span class="o">=</span> <span class="kt">Lock</span><span class="p">()</span>
|
||||
<span class="kd">private</span> <span class="kd">static</span> <span class="k">var</span> <span class="nv">overrideLogLevel</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span>
|
||||
|
||||
<span class="c1">// this holds the log level if not overridden</span>
|
||||
<span class="kd">private</span> <span class="k">var</span> <span class="nv">_logLevel</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span> <span class="o">=</span> <span class="o">.</span><span class="n">info</span>
|
||||
|
||||
<span class="c1">// metadata storage</span>
|
||||
<span class="kd">public</span> <span class="k">var</span> <span class="nv">metadata</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Metadata</span> <span class="o">=</span> <span class="p">[:]</span>
|
||||
|
||||
<span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">label</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="p">{</span>
|
||||
<span class="c1">// [...]</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="kd">public</span> <span class="k">var</span> <span class="nv">logLevel</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span> <span class="p">{</span>
|
||||
<span class="c1">// when we get asked for the log level, we check if it was globally overridden or not</span>
|
||||
<span class="k">get</span> <span class="p">{</span>
|
||||
<span class="k">return</span> <span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLock</span><span class="o">.</span><span class="n">withLock</span> <span class="p">{</span>
|
||||
<span class="k">return</span> <span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLogLevel</span>
|
||||
<span class="p">}</span> <span class="p">??</span> <span class="k">self</span><span class="o">.</span><span class="n">_logLevel</span>
|
||||
<span class="p">}</span>
|
||||
<span class="c1">// we set the log level whenever we're asked (note: this might not have an effect if globally</span>
|
||||
<span class="c1">// overridden)</span>
|
||||
<span class="k">set</span> <span class="p">{</span>
|
||||
<span class="k">self</span><span class="o">.</span><span class="n">_logLevel</span> <span class="o">=</span> <span class="n">newValue</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">log</span><span class="p">(</span><span class="nv">level</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span><span class="p">,</span> <span class="nv">message</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Message</span><span class="p">,</span> <span class="nv">metadata</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Metadata</span><span class="p">?,</span>
|
||||
<span class="nv">file</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">function</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">line</span><span class="p">:</span> <span class="kt">UInt</span><span class="p">)</span> <span class="p">{</span>
|
||||
<span class="c1">// [...]</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="kd">public</span> <span class="nf">subscript</span><span class="p">(</span><span class="n">metadataKey</span> <span class="nv">metadataKey</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Metadata</span><span class="o">.</span><span class="kt">Value</span><span class="p">?</span> <span class="p">{</span>
|
||||
<span class="k">get</span> <span class="p">{</span>
|
||||
<span class="k">return</span> <span class="k">self</span><span class="o">.</span><span class="n">metadata</span><span class="p">[</span><span class="n">metadataKey</span><span class="p">]</span>
|
||||
<span class="p">}</span>
|
||||
<span class="nf">set</span><span class="p">(</span><span class="n">newValue</span><span class="p">)</span> <span class="p">{</span>
|
||||
<span class="k">self</span><span class="o">.</span><span class="n">metadata</span><span class="p">[</span><span class="n">metadataKey</span><span class="p">]</span> <span class="o">=</span> <span class="n">newValue</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="c1">// this is the function to globally override the log level, it is not part of the `LogHandler` protocol</span>
|
||||
<span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="nf">overrideGlobalLogLevel</span><span class="p">(</span><span class="n">_</span> <span class="nv">logLevel</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span><span class="p">)</span> <span class="p">{</span>
|
||||
<span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLock</span><span class="o">.</span><span class="n">withLock</span> <span class="p">{</span>
|
||||
<span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLogLevel</span> <span class="o">=</span> <span class="n">logLevel</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre>
|
||||
|
||||
<p>Please note that the above <code>LogHandler</code> will still pass the ‘log level is a value’ test above it iff the global log
|
||||
level has not been overridden. And most importantly it passes the requirement listed above: A change to the log
|
||||
level on one <code><a href="../Structs/Logger.html">Logger</a></code> should not affect the log level of another <code><a href="../Structs/Logger.html">Logger</a></code> variable.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP3log5level7message8metadata4file8function4lineyAA6LoggerV5LevelO_AL7MessageVSDySSAL13MetadataValueOGSgS2SSutF"></a>
|
||||
<a name="//apple_ref/swift/Method/log(level:message:metadata:file:function:line:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP3log5level7message8metadata4file8function4lineyAA6LoggerV5LevelO_AL7MessageVSDySSAL13MetadataValueOGSgS2SSutF">log(level:message:metadata:file:function:line:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>This method is called when a <code>LogHandler</code> must emit a log message. There is no need for the <code>LogHandler</code> to
|
||||
check if the <code>level</code> is above or below the configured <code><a href="../Protocols/LogHandler.html#/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp">logLevel</a></code> as <code><a href="../Structs/Logger.html">Logger</a></code> already performed this check and
|
||||
determined that a message should be logged.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">log</span><span class="p">(</span><span class="nv">level</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span><span class="p">,</span> <span class="nv">message</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Message</span><span class="p">,</span> <span class="nv">metadata</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span><span class="p">?,</span> <span class="nv">file</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">function</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">line</span><span class="p">:</span> <span class="kt">UInt</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>level</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The log level the message was logged at.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>message</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The message to log. To obtain a <code>String</code> representation call <code>message.description</code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>metadata</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The metadata associated to this log message.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>file</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The file the log message was emitted from.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>function</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The function the log line was emitted from.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>line</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The line the log message was emitted from.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/LogHandler.swift#L126">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP11metadataKeyAA6LoggerV13MetadataValueOSgSS_tcip"></a>
|
||||
<a name="//apple_ref/swift/Method/subscript(metadataKey:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP11metadataKeyAA6LoggerV13MetadataValueOSgSS_tcip">subscript(metadataKey:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Add, remove, or change the logging metadata.</p>
|
||||
<div class="aside aside-note">
|
||||
<p class="aside-title">Note</p>
|
||||
<p><code>LogHandler</code>s must treat logging metadata as a value type. This means that the change in metadata must
|
||||
only affect this very <code>LogHandler</code>.</p>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="nf">subscript</span><span class="p">(</span><span class="n">metadataKey</span> <span class="nv">_</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span><span class="o">.</span><span class="kt">Value</span><span class="p">?</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>metadataKey</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The key for the metadata item</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/LogHandler.swift#L138">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP8metadataSDySSAA6LoggerV13MetadataValueOGvp"></a>
|
||||
<a name="//apple_ref/swift/Property/metadata" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP8metadataSDySSAA6LoggerV13MetadataValueOGvp">metadata</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Get or set the entire metadata storage as a dictionary.</p>
|
||||
<div class="aside aside-note">
|
||||
<p class="aside-title">Note</p>
|
||||
<code>LogHandler</code>s must treat logging metadata as a value type. This means that the change in metadata must
|
||||
only affect this very <code>LogHandler</code>.
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">var</span> <span class="nv">metadata</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/LogHandler.swift#L144">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp"></a>
|
||||
<a name="//apple_ref/swift/Property/logLevel" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp">logLevel</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Get or set the configured log level.</p>
|
||||
<div class="aside aside-note">
|
||||
<p class="aside-title">Note</p>
|
||||
<code>LogHandler</code>s must treat the log level as a value type. This means that the change in metadata must
|
||||
only affect this very <code>LogHandler</code>. It is acceptable to provide some form of global log level override
|
||||
that means a change in log level on a particular <code>LogHandler</code> might not be reflected in any
|
||||
<code>LogHandler</code>.
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">var</span> <span class="nv">logLevel</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/LogHandler.swift#L152">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2019 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external">SwiftLog team</a>. All rights reserved. (Last updated: 2019-09-30)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.10.0</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,224 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Structures Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="js/jquery.min.js" defer></script>
|
||||
<script src="js/jazzy.js" defer></script>
|
||||
|
||||
<script src="js/lunr.min.js" defer></script>
|
||||
<script src="js/typeahead.jquery.js" defer></script>
|
||||
<script src="js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Section/Structures" class="dashAnchor"></a>
|
||||
|
||||
<a title="Structures Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="index.html">
|
||||
Logging Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="index.html">Logging Reference</a>
|
||||
<img class="carat" src="img/carat.png" />
|
||||
Structures Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>Structures</h1>
|
||||
<p>The following structures are available globally.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV"></a>
|
||||
<a name="//apple_ref/swift/Struct/Logger" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV">Logger</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>A <code>Logger</code> is the central type in <code>SwiftLog</code>. Its central function is to emit log messages using one of the methods
|
||||
corresponding to a log level.</p>
|
||||
|
||||
<p>The most basic usage of a <code>Logger</code> is</p>
|
||||
<pre class="highlight swift"><code><span class="n">logger</span><span class="o">.</span><span class="nf">info</span><span class="p">(</span><span class="s">"Hello World!"</span><span class="p">)</span>
|
||||
</code></pre>
|
||||
|
||||
<a href="Structs/Logger.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Logger</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L28-L39">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging19MultiplexLogHandlerV"></a>
|
||||
<a name="//apple_ref/swift/Struct/MultiplexLogHandler" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging19MultiplexLogHandlerV">MultiplexLogHandler</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>A pseudo-<code><a href="Protocols/LogHandler.html">LogHandler</a></code> that can be used to send messages to multiple other <code><a href="Protocols/LogHandler.html">LogHandler</a></code>s.</p>
|
||||
|
||||
<p>The first <code><a href="Protocols/LogHandler.html">LogHandler</a></code> passed to the initialisation function of <code>MultiplexLogHandler</code> control the <code>logLevel</code> as
|
||||
well as the <code>metadata</code> for this <code><a href="Protocols/LogHandler.html">LogHandler</a></code>. Any subsequent <code><a href="Protocols/LogHandler.html">LogHandler</a></code>s used to initialise a
|
||||
<code>MultiplexLogHandler</code> are merely to emit the log message to another place.</p>
|
||||
|
||||
<a href="Structs/MultiplexLogHandler.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">MultiplexLogHandler</span> <span class="p">:</span> <span class="kt"><a href="Protocols/LogHandler.html">LogHandler</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L471-L527">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging16StreamLogHandlerV"></a>
|
||||
<a name="//apple_ref/swift/Struct/StreamLogHandler" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging16StreamLogHandlerV">StreamLogHandler</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p><code>StreamLogHandler</code> is a simple implementation of <code><a href="Protocols/LogHandler.html">LogHandler</a></code> for directing
|
||||
<code><a href="Structs/Logger.html">Logger</a></code> output to either <code>stderr</code> or <code>stdout</code> via the factory methods.</p>
|
||||
|
||||
<a href="Structs/StreamLogHandler.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">StreamLogHandler</span> <span class="p">:</span> <span class="kt"><a href="Protocols/LogHandler.html">LogHandler</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L576-L639">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2019 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external">SwiftLog team</a>. All rights reserved. (Last updated: 2019-09-30)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.10.0</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,381 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Level Enumeration Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../../js/jquery.min.js" defer></script>
|
||||
<script src="../../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../../js/lunr.min.js" defer></script>
|
||||
<script src="../../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Enum/Level" class="dashAnchor"></a>
|
||||
|
||||
<a title="Level Enumeration Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../../index.html">
|
||||
Logging Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="../../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../../index.html">Logging Reference</a>
|
||||
<img class="carat" src="../../img/carat.png" />
|
||||
Level Enumeration Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>Level</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Level</span> <span class="p">:</span> <span class="kt">CaseIterable</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>The log level.</p>
|
||||
|
||||
<p>Log levels are ordered by their severity, with <code>.trace</code> being the least severe and
|
||||
<code>.critical</code> being the most severe.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV5LevelO5traceyA2EmF"></a>
|
||||
<a name="//apple_ref/swift/Element/trace" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV5LevelO5traceyA2EmF">trace</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Appropriate for messages that contain information only when debugging a program.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">trace</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L332">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV5LevelO5debugyA2EmF"></a>
|
||||
<a name="//apple_ref/swift/Element/debug" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV5LevelO5debugyA2EmF">debug</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Appropriate for messages that contain information normally of use only when
|
||||
debugging a program.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">debug</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L336">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV5LevelO4infoyA2EmF"></a>
|
||||
<a name="//apple_ref/swift/Element/info" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV5LevelO4infoyA2EmF">info</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Appropriate for informational messages.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">info</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L339">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV5LevelO6noticeyA2EmF"></a>
|
||||
<a name="//apple_ref/swift/Element/notice" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV5LevelO6noticeyA2EmF">notice</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Appropriate for conditions that are not error conditions, but that may require
|
||||
special handling.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">notice</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L343">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV5LevelO7warningyA2EmF"></a>
|
||||
<a name="//apple_ref/swift/Element/warning" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV5LevelO7warningyA2EmF">warning</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Appropriate for messages that are not error conditions, but more severe than
|
||||
<code><a href="../../Structs/Logger/Level.html#/s:7Logging6LoggerV5LevelO6noticeyA2EmF">.notice</a></code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">warning</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L347">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV5LevelO5erroryA2EmF"></a>
|
||||
<a name="//apple_ref/swift/Element/error" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV5LevelO5erroryA2EmF">error</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Appropriate for error conditions.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">error</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L350">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV5LevelO8criticalyA2EmF"></a>
|
||||
<a name="//apple_ref/swift/Element/critical" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV5LevelO8criticalyA2EmF">critical</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Appropriate for critical error conditions that usually require immediate
|
||||
attention.</p>
|
||||
|
||||
<p>When a <code>critical</code> message is logged, the logging backend (<code><a href="../../Protocols/LogHandler.html">LogHandler</a></code>) is free to perform
|
||||
more heavy-weight operations to capture system state (such as capturing stack traces) to facilitate
|
||||
debugging.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">critical</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L358">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:SL1loiySbx_xtFZ"></a>
|
||||
<a name="//apple_ref/swift/Method/<(_:_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:SL1loiySbx_xtFZ"><(_:_:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o"><</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span><span class="p">,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span><span class="p">)</span> <span class="o">-></span> <span class="kt">Bool</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L410-L412">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2019 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external">SwiftLog team</a>. All rights reserved. (Last updated: 2019-09-30)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.10.0</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,226 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Message Structure Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../../js/jquery.min.js" defer></script>
|
||||
<script src="../../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../../js/lunr.min.js" defer></script>
|
||||
<script src="../../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Struct/Message" class="dashAnchor"></a>
|
||||
|
||||
<a title="Message Structure Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../../index.html">
|
||||
Logging Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="../../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../../index.html">Logging Reference</a>
|
||||
<img class="carat" src="../../img/carat.png" />
|
||||
Message Structure Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>Message</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Message</span><span class="p">:</span> <span class="kt">ExpressibleByStringLiteral</span><span class="p">,</span>
|
||||
<span class="kt">Equatable</span><span class="p">,</span>
|
||||
<span class="kt">CustomStringConvertible</span><span class="p">,</span>
|
||||
<span class="kt">ExpressibleByStringInterpolation</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p><code>Logger.Message</code> represents a log message’s text. It is usually created using string literals.</p>
|
||||
|
||||
<p>Example creating a <code>Logger.Message</code>:</p>
|
||||
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">world</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"world"</span>
|
||||
<span class="k">let</span> <span class="nv">myLogMessage</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Message</span> <span class="o">=</span> <span class="s">"Hello </span><span class="se">\(</span><span class="n">world</span><span class="se">)</span><span class="s">"</span>
|
||||
</code></pre>
|
||||
|
||||
<p>Most commonly, <code>Logger.Message</code>s appear simply as the parameter to a logging method such as:</p>
|
||||
<pre class="highlight swift"><code><span class="n">logger</span><span class="o">.</span><span class="nf">info</span><span class="p">(</span><span class="s">"Hello </span><span class="se">\(</span><span class="n">world</span><span class="se">)</span><span class="s">"</span><span class="p">)</span>
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s26ExpressibleByStringLiteralP0cD4TypeQa"></a>
|
||||
<a name="//apple_ref/swift/Alias/StringLiteralType" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s26ExpressibleByStringLiteralP0cD4TypeQa">StringLiteralType</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">StringLiteralType</span> <span class="o">=</span> <span class="kt">String</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s26ExpressibleByStringLiteralP06stringD0x0cD4TypeQz_tcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(stringLiteral:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s26ExpressibleByStringLiteralP06stringD0x0cD4TypeQz_tcfc">init(stringLiteral:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">stringLiteral</span> <span class="nv">value</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L456-L458">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s23CustomStringConvertibleP11descriptionSSvp"></a>
|
||||
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s23CustomStringConvertibleP11descriptionSSvp">description</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L460-L462">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2019 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external">SwiftLog team</a>. All rights reserved. (Last updated: 2019-09-30)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.10.0</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,552 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>MetadataValue Enumeration Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../../js/jquery.min.js" defer></script>
|
||||
<script src="../../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../../js/lunr.min.js" defer></script>
|
||||
<script src="../../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Enum/MetadataValue" class="dashAnchor"></a>
|
||||
|
||||
<a title="MetadataValue Enumeration Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../../index.html">
|
||||
Logging Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="../../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../../index.html">Logging Reference</a>
|
||||
<img class="carat" src="../../img/carat.png" />
|
||||
MetadataValue Enumeration Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>MetadataValue</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">MetadataValue</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>A logging metadata value. <code>Logger.MetadataValue</code> is string, array, and dictionary literal convertible.</p>
|
||||
|
||||
<p><code>MetadataValue</code> provides convenient conformances to <code>ExpressibleByStringInterpolation</code>,
|
||||
<code>ExpressibleByStringLiteral</code>, <code>ExpressibleByArrayLiteral</code>, and <code>ExpressibleByDictionaryLiteral</code> which means
|
||||
that when constructing <code>MetadataValue</code>s you should default to using Swift’s usual literals.</p>
|
||||
|
||||
<p>Examples:</p>
|
||||
|
||||
<ul>
|
||||
<li>prefer <code>logger.info("user logged in", metadata: ["user-id": "\(user.id)"])</code> over
|
||||
<code>..., metadata: ["user-id": .string(user.id.description)])</code></li>
|
||||
<li>prefer <code>logger.info("user selected colours", metadata: ["colors": ["\(user.topColor)", "\(user.secondColor)"]])</code>
|
||||
over <code>..., metadata: ["colors": .array([.string("\(user.topColor)"), .string("\(user.secondColor)")])</code></li>
|
||||
<li>prefer <code>logger.info("nested info", metadata: ["nested": ["fave-numbers": ["\(1)", "\(2)", "\(3)"], "foo": "bar"]])</code>
|
||||
over <code>..., metadata: ["nested": .dictionary(["fave-numbers": ...])])</code></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV13MetadataValueO6stringyAESScAEmF"></a>
|
||||
<a name="//apple_ref/swift/Element/string(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV13MetadataValueO6stringyAESScAEmF">string(_:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>A metadata value which is a <code>String</code>.</p>
|
||||
|
||||
<p>Because <code>MetadataValue</code> implements <code>ExpressibleByStringInterpolation</code>, and <code>ExpressibleByStringLiteral</code>,
|
||||
you don’t need to type <code>.string(someType.description)</code> you can use the string interpolation <code>"\(someType)"</code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">string</span><span class="p">(</span><span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L308">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV13MetadataValueO17stringConvertibleyAEs012CustomStringF0_pcAEmF"></a>
|
||||
<a name="//apple_ref/swift/Element/stringConvertible(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV13MetadataValueO17stringConvertibleyAEs012CustomStringF0_pcAEmF">stringConvertible(_:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>A metadata value which is some <code>CustomStringConvertible</code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">stringConvertible</span><span class="p">(</span><span class="kt">CustomStringConvertible</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L311">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV13MetadataValueO10dictionaryyAESDySSAEGcAEmF"></a>
|
||||
<a name="//apple_ref/swift/Element/dictionary(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV13MetadataValueO10dictionaryyAESDySSAEGcAEmF">dictionary(_:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>A metadata value which is a dictionary from <code>String</code> to <code>Logger.MetadataValue</code>.</p>
|
||||
|
||||
<p>Because <code>MetadataValue</code> implements <code>ExpressibleByDictionaryLiteral</code>, you don’t need to type
|
||||
<code>.dictionary(["foo": .string("bar \(buz)")])</code>, you can just use the more natural <code>["foo": "bar \(buz)"]</code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">dictionary</span><span class="p">(</span><span class="kt"><a href="../../Structs/Logger.html#/s:7Logging6LoggerV8Metadataa">Metadata</a></span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L317">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV13MetadataValueO5arrayyAESayAEGcAEmF"></a>
|
||||
<a name="//apple_ref/swift/Element/array(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV13MetadataValueO5arrayyAESayAEGcAEmF">array(_:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>A metadata value which is an array of <code>Logger.MetadataValue</code>s.</p>
|
||||
|
||||
<p>Because <code>MetadataValue</code> implements <code>ExpressibleByArrayLiteral</code>, you don’t need to type
|
||||
<code>.array([.string("foo"), .string("bar \(buz)")])</code>, you can just use the more natural <code>["foo", "bar \(buz)"]</code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">array</span><span class="p">([</span><span class="kt"><a href="../../Structs/Logger.html#/s:7Logging6LoggerV8Metadataa">Metadata</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger/MetadataValue.html#/s:s30ExpressibleByDictionaryLiteralP5ValueQa">Value</a></span><span class="p">])</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L323">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:SQ2eeoiySbx_xtFZ"></a>
|
||||
<a name="//apple_ref/swift/Method/==(_:_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:SQ2eeoiySbx_xtFZ">==(_:_:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger.html#/s:7Logging6LoggerV8Metadataa">Metadata</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger/MetadataValue.html#/s:s30ExpressibleByDictionaryLiteralP5ValueQa">Value</a></span><span class="p">,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger.html#/s:7Logging6LoggerV8Metadataa">Metadata</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger/MetadataValue.html#/s:s30ExpressibleByDictionaryLiteralP5ValueQa">Value</a></span><span class="p">)</span> <span class="o">-></span> <span class="kt">Bool</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L420-L433">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s26ExpressibleByStringLiteralP0cD4TypeQa"></a>
|
||||
<a name="//apple_ref/swift/Alias/StringLiteralType" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s26ExpressibleByStringLiteralP0cD4TypeQa">StringLiteralType</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">StringLiteralType</span> <span class="o">=</span> <span class="kt">String</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s26ExpressibleByStringLiteralP06stringD0x0cD4TypeQz_tcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(stringLiteral:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s26ExpressibleByStringLiteralP06stringD0x0cD4TypeQz_tcfc">init(stringLiteral:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">stringLiteral</span> <span class="nv">value</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L646-L648">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s23CustomStringConvertibleP11descriptionSSvp"></a>
|
||||
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s23CustomStringConvertibleP11descriptionSSvp">description</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L654-L665">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s30ExpressibleByDictionaryLiteralP3KeyQa"></a>
|
||||
<a name="//apple_ref/swift/Alias/Key" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s30ExpressibleByDictionaryLiteralP3KeyQa">Key</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Key</span> <span class="o">=</span> <span class="kt">String</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s30ExpressibleByDictionaryLiteralP5ValueQa"></a>
|
||||
<a name="//apple_ref/swift/Alias/Value" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s30ExpressibleByDictionaryLiteralP5ValueQa">Value</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Value</span> <span class="o">=</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger.html#/s:7Logging6LoggerV8Metadataa">Metadata</a></span><span class="o">.</span><span class="kt">Value</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s30ExpressibleByDictionaryLiteralP010dictionaryD0x3KeyQz_5ValueQztd_tcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(dictionaryLiteral:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s30ExpressibleByDictionaryLiteralP010dictionaryD0x3KeyQz_5ValueQztd_tcfc">init(dictionaryLiteral:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">dictionaryLiteral</span> <span class="nv">elements</span><span class="p">:</span> <span class="p">(</span><span class="kt">String</span><span class="p">,</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger.html#/s:7Logging6LoggerV8Metadataa">Metadata</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger/MetadataValue.html#/s:s30ExpressibleByDictionaryLiteralP5ValueQa">Value</a></span><span class="p">)</span><span class="o">...</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L678-L680">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s25ExpressibleByArrayLiteralP0cD7ElementQa"></a>
|
||||
<a name="//apple_ref/swift/Alias/ArrayLiteralElement" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s25ExpressibleByArrayLiteralP0cD7ElementQa">ArrayLiteralElement</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">ArrayLiteralElement</span> <span class="o">=</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger.html#/s:7Logging6LoggerV8Metadataa">Metadata</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger/MetadataValue.html#/s:s30ExpressibleByDictionaryLiteralP5ValueQa">Value</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s25ExpressibleByArrayLiteralP05arrayD0x0cD7ElementQzd_tcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(arrayLiteral:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s25ExpressibleByArrayLiteralP05arrayD0x0cD7ElementQzd_tcfc">init(arrayLiteral:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">arrayLiteral</span> <span class="nv">elements</span><span class="p">:</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger.html#/s:7Logging6LoggerV8Metadataa">Metadata</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger/MetadataValue.html#/s:s30ExpressibleByDictionaryLiteralP5ValueQa">Value</a></span><span class="o">...</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L688-L690">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2019 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external">SwiftLog team</a>. All rights reserved. (Last updated: 2019-09-30)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.10.0</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,300 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>MultiplexLogHandler Structure Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../js/jquery.min.js" defer></script>
|
||||
<script src="../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../js/lunr.min.js" defer></script>
|
||||
<script src="../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Struct/MultiplexLogHandler" class="dashAnchor"></a>
|
||||
|
||||
<a title="MultiplexLogHandler Structure Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
Logging Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">Logging Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
MultiplexLogHandler Structure Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>MultiplexLogHandler</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">MultiplexLogHandler</span> <span class="p">:</span> <span class="kt"><a href="../Protocols/LogHandler.html">LogHandler</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>A pseudo-<code><a href="../Protocols/LogHandler.html">LogHandler</a></code> that can be used to send messages to multiple other <code><a href="../Protocols/LogHandler.html">LogHandler</a></code>s.</p>
|
||||
|
||||
<p>The first <code><a href="../Protocols/LogHandler.html">LogHandler</a></code> passed to the initialisation function of <code>MultiplexLogHandler</code> control the <code>logLevel</code> as
|
||||
well as the <code>metadata</code> for this <code><a href="../Protocols/LogHandler.html">LogHandler</a></code>. Any subsequent <code><a href="../Protocols/LogHandler.html">LogHandler</a></code>s used to initialise a
|
||||
<code>MultiplexLogHandler</code> are merely to emit the log message to another place.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging19MultiplexLogHandlerVyACSayAA0cD0_pGcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging19MultiplexLogHandlerVyACSayAA0cD0_pGcfc">init(_:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Create a <code>MultiplexLogHandler</code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">_</span> <span class="nv">handlers</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Protocols/LogHandler.html">LogHandler</a></span><span class="p">])</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>handlers</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>An array of <code><a href="../Protocols/LogHandler.html">LogHandler</a></code>s, each of which will receive the log messages sent to this <code><a href="../Structs/Logger.html">Logger</a></code>.
|
||||
The array must not be empty.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L479-L482">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp"></a>
|
||||
<a name="//apple_ref/swift/Property/logLevel" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp">logLevel</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">logLevel</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L484-L493">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP3log5level7message8metadata4file8function4lineyAA6LoggerV5LevelO_AL7MessageVSDySSAL13MetadataValueOGSgS2SSutF"></a>
|
||||
<a name="//apple_ref/swift/Method/log(level:message:metadata:file:function:line:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP3log5level7message8metadata4file8function4lineyAA6LoggerV5LevelO_AL7MessageVSDySSAL13MetadataValueOGSgS2SSutF">log(level:message:metadata:file:function:line:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">log</span><span class="p">(</span><span class="nv">level</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span><span class="p">,</span>
|
||||
<span class="nv">message</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Message</span><span class="p">,</span>
|
||||
<span class="nv">metadata</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span><span class="p">?,</span>
|
||||
<span class="nv">file</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">function</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">line</span><span class="p">:</span> <span class="kt">UInt</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L495-L502">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP8metadataSDySSAA6LoggerV13MetadataValueOGvp"></a>
|
||||
<a name="//apple_ref/swift/Property/metadata" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP8metadataSDySSAA6LoggerV13MetadataValueOGvp">metadata</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">metadata</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L504-L511">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP11metadataKeyAA6LoggerV13MetadataValueOSgSS_tcip"></a>
|
||||
<a name="//apple_ref/swift/Method/subscript(metadataKey:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP11metadataKeyAA6LoggerV13MetadataValueOSgSS_tcip">subscript(metadataKey:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">subscript</span><span class="p">(</span><span class="n">metadataKey</span> <span class="nv">metadataKey</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span><span class="o">.</span><span class="kt">Value</span><span class="p">?</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L513-L520">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2019 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external">SwiftLog team</a>. All rights reserved. (Last updated: 2019-09-30)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.10.0</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,307 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>StreamLogHandler Structure Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../js/jquery.min.js" defer></script>
|
||||
<script src="../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../js/lunr.min.js" defer></script>
|
||||
<script src="../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Struct/StreamLogHandler" class="dashAnchor"></a>
|
||||
|
||||
<a title="StreamLogHandler Structure Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
Logging Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">Logging Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
StreamLogHandler Structure Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>StreamLogHandler</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">StreamLogHandler</span> <span class="p">:</span> <span class="kt"><a href="../Protocols/LogHandler.html">LogHandler</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p><code>StreamLogHandler</code> is a simple implementation of <code><a href="../Protocols/LogHandler.html">LogHandler</a></code> for directing
|
||||
<code><a href="../Structs/Logger.html">Logger</a></code> output to either <code>stderr</code> or <code>stdout</code> via the factory methods.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging16StreamLogHandlerV14standardOutput5labelACSS_tFZ"></a>
|
||||
<a name="//apple_ref/swift/Method/standardOutput(label:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging16StreamLogHandlerV14standardOutput5labelACSS_tFZ">standardOutput(label:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Factory that makes a <code>StreamLogHandler</code> to directs its output to <code>stdout</code></p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="nf">standardOutput</span><span class="p">(</span><span class="nv">label</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt">StreamLogHandler</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L578-L580">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging16StreamLogHandlerV13standardError5labelACSS_tFZ"></a>
|
||||
<a name="//apple_ref/swift/Method/standardError(label:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging16StreamLogHandlerV13standardError5labelACSS_tFZ">standardError(label:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Factory that makes a <code>StreamLogHandler</code> to directs its output to <code>stderr</code></p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="nf">standardError</span><span class="p">(</span><span class="nv">label</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt">StreamLogHandler</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L583-L585">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp"></a>
|
||||
<a name="//apple_ref/swift/Property/logLevel" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp">logLevel</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">logLevel</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L152">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP8metadataSDySSAA6LoggerV13MetadataValueOGvp"></a>
|
||||
<a name="//apple_ref/swift/Property/metadata" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP8metadataSDySSAA6LoggerV13MetadataValueOGvp">metadata</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">metadata</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L592-L596">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP11metadataKeyAA6LoggerV13MetadataValueOSgSS_tcip"></a>
|
||||
<a name="//apple_ref/swift/Method/subscript(metadataKey:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP11metadataKeyAA6LoggerV13MetadataValueOSgSS_tcip">subscript(metadataKey:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">subscript</span><span class="p">(</span><span class="n">metadataKey</span> <span class="nv">metadataKey</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span><span class="o">.</span><span class="kt">Value</span><span class="p">?</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L598-L605">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP3log5level7message8metadata4file8function4lineyAA6LoggerV5LevelO_AL7MessageVSDySSAL13MetadataValueOGSgS2SSutF"></a>
|
||||
<a name="//apple_ref/swift/Method/log(level:message:metadata:file:function:line:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP3log5level7message8metadata4file8function4lineyAA6LoggerV5LevelO_AL7MessageVSDySSAL13MetadataValueOGSgS2SSutF">log(level:message:metadata:file:function:line:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">log</span><span class="p">(</span><span class="nv">level</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span><span class="p">,</span>
|
||||
<span class="nv">message</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Message</span><span class="p">,</span>
|
||||
<span class="nv">metadata</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span><span class="p">?,</span>
|
||||
<span class="nv">file</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">function</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">line</span><span class="p">:</span> <span class="kt">UInt</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.1.1/Sources/Logging/Logging.swift#L612-L622">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2019 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external">SwiftLog team</a>. All rights reserved. (Last updated: 2019-09-30)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.10.0</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,28 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="136" height="20">
|
||||
<linearGradient id="b" x2="0" y2="100%">
|
||||
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
||||
<stop offset="1" stop-opacity=".1"/>
|
||||
</linearGradient>
|
||||
<clipPath id="a">
|
||||
<rect width="136" height="20" rx="3" fill="#fff"/>
|
||||
</clipPath>
|
||||
<g clip-path="url(#a)">
|
||||
<path fill="#555" d="M0 0h93v20H0z"/>
|
||||
<path fill="#4c1" d="M93 0h43v20H93z"/>
|
||||
<path fill="url(#b)" d="M0 0h136v20H0z"/>
|
||||
</g>
|
||||
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110">
|
||||
<text x="475" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="830">
|
||||
documentation
|
||||
</text>
|
||||
<text x="475" y="140" transform="scale(.1)" textLength="830">
|
||||
documentation
|
||||
</text>
|
||||
<text x="1135" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="330">
|
||||
100%
|
||||
</text>
|
||||
<text x="1135" y="140" transform="scale(.1)" textLength="330">
|
||||
100%
|
||||
</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -1,200 +0,0 @@
|
||||
/* Credit to https://gist.github.com/wataru420/2048287 */
|
||||
.highlight {
|
||||
/* Comment */
|
||||
/* Error */
|
||||
/* Keyword */
|
||||
/* Operator */
|
||||
/* Comment.Multiline */
|
||||
/* Comment.Preproc */
|
||||
/* Comment.Single */
|
||||
/* Comment.Special */
|
||||
/* Generic.Deleted */
|
||||
/* Generic.Deleted.Specific */
|
||||
/* Generic.Emph */
|
||||
/* Generic.Error */
|
||||
/* Generic.Heading */
|
||||
/* Generic.Inserted */
|
||||
/* Generic.Inserted.Specific */
|
||||
/* Generic.Output */
|
||||
/* Generic.Prompt */
|
||||
/* Generic.Strong */
|
||||
/* Generic.Subheading */
|
||||
/* Generic.Traceback */
|
||||
/* Keyword.Constant */
|
||||
/* Keyword.Declaration */
|
||||
/* Keyword.Pseudo */
|
||||
/* Keyword.Reserved */
|
||||
/* Keyword.Type */
|
||||
/* Literal.Number */
|
||||
/* Literal.String */
|
||||
/* Name.Attribute */
|
||||
/* Name.Builtin */
|
||||
/* Name.Class */
|
||||
/* Name.Constant */
|
||||
/* Name.Entity */
|
||||
/* Name.Exception */
|
||||
/* Name.Function */
|
||||
/* Name.Namespace */
|
||||
/* Name.Tag */
|
||||
/* Name.Variable */
|
||||
/* Operator.Word */
|
||||
/* Text.Whitespace */
|
||||
/* Literal.Number.Float */
|
||||
/* Literal.Number.Hex */
|
||||
/* Literal.Number.Integer */
|
||||
/* Literal.Number.Oct */
|
||||
/* Literal.String.Backtick */
|
||||
/* Literal.String.Char */
|
||||
/* Literal.String.Doc */
|
||||
/* Literal.String.Double */
|
||||
/* Literal.String.Escape */
|
||||
/* Literal.String.Heredoc */
|
||||
/* Literal.String.Interpol */
|
||||
/* Literal.String.Other */
|
||||
/* Literal.String.Regex */
|
||||
/* Literal.String.Single */
|
||||
/* Literal.String.Symbol */
|
||||
/* Name.Builtin.Pseudo */
|
||||
/* Name.Variable.Class */
|
||||
/* Name.Variable.Global */
|
||||
/* Name.Variable.Instance */
|
||||
/* Literal.Number.Integer.Long */ }
|
||||
.highlight .c {
|
||||
color: #999988;
|
||||
font-style: italic; }
|
||||
.highlight .err {
|
||||
color: #a61717;
|
||||
background-color: #e3d2d2; }
|
||||
.highlight .k {
|
||||
color: #000000;
|
||||
font-weight: bold; }
|
||||
.highlight .o {
|
||||
color: #000000;
|
||||
font-weight: bold; }
|
||||
.highlight .cm {
|
||||
color: #999988;
|
||||
font-style: italic; }
|
||||
.highlight .cp {
|
||||
color: #999999;
|
||||
font-weight: bold; }
|
||||
.highlight .c1 {
|
||||
color: #999988;
|
||||
font-style: italic; }
|
||||
.highlight .cs {
|
||||
color: #999999;
|
||||
font-weight: bold;
|
||||
font-style: italic; }
|
||||
.highlight .gd {
|
||||
color: #000000;
|
||||
background-color: #ffdddd; }
|
||||
.highlight .gd .x {
|
||||
color: #000000;
|
||||
background-color: #ffaaaa; }
|
||||
.highlight .ge {
|
||||
color: #000000;
|
||||
font-style: italic; }
|
||||
.highlight .gr {
|
||||
color: #aa0000; }
|
||||
.highlight .gh {
|
||||
color: #999999; }
|
||||
.highlight .gi {
|
||||
color: #000000;
|
||||
background-color: #ddffdd; }
|
||||
.highlight .gi .x {
|
||||
color: #000000;
|
||||
background-color: #aaffaa; }
|
||||
.highlight .go {
|
||||
color: #888888; }
|
||||
.highlight .gp {
|
||||
color: #555555; }
|
||||
.highlight .gs {
|
||||
font-weight: bold; }
|
||||
.highlight .gu {
|
||||
color: #aaaaaa; }
|
||||
.highlight .gt {
|
||||
color: #aa0000; }
|
||||
.highlight .kc {
|
||||
color: #000000;
|
||||
font-weight: bold; }
|
||||
.highlight .kd {
|
||||
color: #000000;
|
||||
font-weight: bold; }
|
||||
.highlight .kp {
|
||||
color: #000000;
|
||||
font-weight: bold; }
|
||||
.highlight .kr {
|
||||
color: #000000;
|
||||
font-weight: bold; }
|
||||
.highlight .kt {
|
||||
color: #445588; }
|
||||
.highlight .m {
|
||||
color: #009999; }
|
||||
.highlight .s {
|
||||
color: #d14; }
|
||||
.highlight .na {
|
||||
color: #008080; }
|
||||
.highlight .nb {
|
||||
color: #0086B3; }
|
||||
.highlight .nc {
|
||||
color: #445588;
|
||||
font-weight: bold; }
|
||||
.highlight .no {
|
||||
color: #008080; }
|
||||
.highlight .ni {
|
||||
color: #800080; }
|
||||
.highlight .ne {
|
||||
color: #990000;
|
||||
font-weight: bold; }
|
||||
.highlight .nf {
|
||||
color: #990000; }
|
||||
.highlight .nn {
|
||||
color: #555555; }
|
||||
.highlight .nt {
|
||||
color: #000080; }
|
||||
.highlight .nv {
|
||||
color: #008080; }
|
||||
.highlight .ow {
|
||||
color: #000000;
|
||||
font-weight: bold; }
|
||||
.highlight .w {
|
||||
color: #bbbbbb; }
|
||||
.highlight .mf {
|
||||
color: #009999; }
|
||||
.highlight .mh {
|
||||
color: #009999; }
|
||||
.highlight .mi {
|
||||
color: #009999; }
|
||||
.highlight .mo {
|
||||
color: #009999; }
|
||||
.highlight .sb {
|
||||
color: #d14; }
|
||||
.highlight .sc {
|
||||
color: #d14; }
|
||||
.highlight .sd {
|
||||
color: #d14; }
|
||||
.highlight .s2 {
|
||||
color: #d14; }
|
||||
.highlight .se {
|
||||
color: #d14; }
|
||||
.highlight .sh {
|
||||
color: #d14; }
|
||||
.highlight .si {
|
||||
color: #d14; }
|
||||
.highlight .sx {
|
||||
color: #d14; }
|
||||
.highlight .sr {
|
||||
color: #009926; }
|
||||
.highlight .s1 {
|
||||
color: #d14; }
|
||||
.highlight .ss {
|
||||
color: #990073; }
|
||||
.highlight .bp {
|
||||
color: #999999; }
|
||||
.highlight .vc {
|
||||
color: #008080; }
|
||||
.highlight .vg {
|
||||
color: #008080; }
|
||||
.highlight .vi {
|
||||
color: #008080; }
|
||||
.highlight .il {
|
||||
color: #009999; }
|
||||
@@ -1,372 +0,0 @@
|
||||
*, *:before, *:after {
|
||||
box-sizing: inherit; }
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
background: #fff;
|
||||
color: #333;
|
||||
font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
letter-spacing: .2px;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
box-sizing: border-box; }
|
||||
|
||||
h1 {
|
||||
font-size: 2rem;
|
||||
font-weight: 700;
|
||||
margin: 1.275em 0 0.6em; }
|
||||
|
||||
h2 {
|
||||
font-size: 1.75rem;
|
||||
font-weight: 700;
|
||||
margin: 1.275em 0 0.3em; }
|
||||
|
||||
h3 {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
margin: 1em 0 0.3em; }
|
||||
|
||||
h4 {
|
||||
font-size: 1.25rem;
|
||||
font-weight: 700;
|
||||
margin: 1.275em 0 0.85em; }
|
||||
|
||||
h5 {
|
||||
font-size: 1rem;
|
||||
font-weight: 700;
|
||||
margin: 1.275em 0 0.85em; }
|
||||
|
||||
h6 {
|
||||
font-size: 1rem;
|
||||
font-weight: 700;
|
||||
margin: 1.275em 0 0.85em;
|
||||
color: #777; }
|
||||
|
||||
p {
|
||||
margin: 0 0 1em; }
|
||||
|
||||
ul, ol {
|
||||
padding: 0 0 0 2em;
|
||||
margin: 0 0 0.85em; }
|
||||
|
||||
blockquote {
|
||||
margin: 0 0 0.85em;
|
||||
padding: 0 15px;
|
||||
color: #858585;
|
||||
border-left: 4px solid #e5e5e5; }
|
||||
|
||||
img {
|
||||
max-width: 100%; }
|
||||
|
||||
a {
|
||||
color: #4183c4;
|
||||
text-decoration: none; }
|
||||
a:hover, a:focus {
|
||||
outline: 0;
|
||||
text-decoration: underline; }
|
||||
a.discouraged {
|
||||
text-decoration: line-through; }
|
||||
a.discouraged:hover, a.discouraged:focus {
|
||||
text-decoration: underline line-through; }
|
||||
|
||||
table {
|
||||
background: #fff;
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
overflow: auto;
|
||||
margin: 0 0 0.85em; }
|
||||
|
||||
tr:nth-child(2n) {
|
||||
background-color: #fbfbfb; }
|
||||
|
||||
th, td {
|
||||
padding: 6px 13px;
|
||||
border: 1px solid #ddd; }
|
||||
|
||||
pre {
|
||||
margin: 0 0 1.275em;
|
||||
padding: .85em 1em;
|
||||
overflow: auto;
|
||||
background: #f7f7f7;
|
||||
font-size: .85em;
|
||||
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; }
|
||||
|
||||
code {
|
||||
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; }
|
||||
|
||||
p > code, li > code {
|
||||
background: #f7f7f7;
|
||||
padding: .2em; }
|
||||
p > code:before, p > code:after, li > code:before, li > code:after {
|
||||
letter-spacing: -.2em;
|
||||
content: "\00a0"; }
|
||||
|
||||
pre code {
|
||||
padding: 0;
|
||||
white-space: pre; }
|
||||
|
||||
.content-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column; }
|
||||
@media (min-width: 768px) {
|
||||
.content-wrapper {
|
||||
flex-direction: row; } }
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
padding: 8px;
|
||||
font-size: 0.875em;
|
||||
background: #444;
|
||||
color: #999; }
|
||||
|
||||
.header-col {
|
||||
margin: 0;
|
||||
padding: 0 8px; }
|
||||
|
||||
.header-col--primary {
|
||||
flex: 1; }
|
||||
|
||||
.header-link {
|
||||
color: #fff; }
|
||||
|
||||
.header-icon {
|
||||
padding-right: 6px;
|
||||
vertical-align: -4px;
|
||||
height: 16px; }
|
||||
|
||||
.breadcrumbs {
|
||||
font-size: 0.875em;
|
||||
padding: 8px 16px;
|
||||
margin: 0;
|
||||
background: #fbfbfb;
|
||||
border-bottom: 1px solid #ddd; }
|
||||
|
||||
.carat {
|
||||
height: 10px;
|
||||
margin: 0 5px; }
|
||||
|
||||
.navigation {
|
||||
order: 2; }
|
||||
@media (min-width: 768px) {
|
||||
.navigation {
|
||||
order: 1;
|
||||
width: 25%;
|
||||
max-width: 300px;
|
||||
padding-bottom: 64px;
|
||||
overflow: hidden;
|
||||
word-wrap: normal;
|
||||
background: #fbfbfb;
|
||||
border-right: 1px solid #ddd; } }
|
||||
|
||||
.nav-groups {
|
||||
list-style-type: none;
|
||||
padding-left: 0; }
|
||||
|
||||
.nav-group-name {
|
||||
border-bottom: 1px solid #ddd;
|
||||
padding: 8px 0 8px 16px; }
|
||||
|
||||
.nav-group-name-link {
|
||||
color: #333; }
|
||||
|
||||
.nav-group-tasks {
|
||||
margin: 8px 0;
|
||||
padding: 0 0 0 8px; }
|
||||
|
||||
.nav-group-task {
|
||||
font-size: 1em;
|
||||
list-style-type: none;
|
||||
white-space: nowrap; }
|
||||
|
||||
.nav-group-task-link {
|
||||
color: #808080; }
|
||||
|
||||
.main-content {
|
||||
order: 1; }
|
||||
@media (min-width: 768px) {
|
||||
.main-content {
|
||||
order: 2;
|
||||
flex: 1;
|
||||
padding-bottom: 60px; } }
|
||||
|
||||
.section {
|
||||
padding: 0 32px;
|
||||
border-bottom: 1px solid #ddd; }
|
||||
|
||||
.section-content {
|
||||
max-width: 834px;
|
||||
margin: 0 auto;
|
||||
padding: 16px 0; }
|
||||
|
||||
.section-name {
|
||||
color: #666;
|
||||
display: block; }
|
||||
|
||||
.declaration .highlight {
|
||||
overflow-x: initial;
|
||||
padding: 8px 0;
|
||||
margin: 0;
|
||||
background-color: transparent;
|
||||
border: none; }
|
||||
|
||||
.task-group-section {
|
||||
border-top: 1px solid #ddd; }
|
||||
|
||||
.task-group {
|
||||
padding-top: 0px; }
|
||||
|
||||
.task-name-container a[name]:before {
|
||||
content: "";
|
||||
display: block; }
|
||||
|
||||
.item-container {
|
||||
padding: 0; }
|
||||
|
||||
.item {
|
||||
padding-top: 8px;
|
||||
width: 100%;
|
||||
list-style-type: none; }
|
||||
.item a[name]:before {
|
||||
content: "";
|
||||
display: block; }
|
||||
.item .token, .item .direct-link {
|
||||
padding-left: 3px;
|
||||
margin-left: 0px;
|
||||
font-size: 1rem; }
|
||||
.item .declaration-note {
|
||||
font-size: .85em;
|
||||
color: #808080;
|
||||
font-style: italic; }
|
||||
|
||||
.pointer-container {
|
||||
border-bottom: 1px solid #ddd;
|
||||
left: -23px;
|
||||
padding-bottom: 13px;
|
||||
position: relative;
|
||||
width: 110%; }
|
||||
|
||||
.pointer {
|
||||
left: 21px;
|
||||
top: 7px;
|
||||
display: block;
|
||||
position: absolute;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-left: 1px solid #ddd;
|
||||
border-top: 1px solid #ddd;
|
||||
background: #fff;
|
||||
transform: rotate(45deg); }
|
||||
|
||||
.height-container {
|
||||
display: none;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
overflow: hidden; }
|
||||
.height-container .section {
|
||||
background: #fff;
|
||||
border: 1px solid #ddd;
|
||||
border-top-width: 0;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 5px;
|
||||
padding: 8px 16px; }
|
||||
|
||||
.aside, .language {
|
||||
padding: 6px 12px;
|
||||
margin: 12px 0;
|
||||
border-left: 5px solid #dddddd;
|
||||
overflow-y: hidden; }
|
||||
.aside .aside-title, .language .aside-title {
|
||||
font-size: 9px;
|
||||
letter-spacing: 2px;
|
||||
text-transform: uppercase;
|
||||
padding-bottom: 0;
|
||||
margin: 0;
|
||||
color: #aaa;
|
||||
-webkit-user-select: none; }
|
||||
.aside p:last-child, .language p:last-child {
|
||||
margin-bottom: 0; }
|
||||
|
||||
.language {
|
||||
border-left: 5px solid #cde9f4; }
|
||||
.language .aside-title {
|
||||
color: #4183c4; }
|
||||
|
||||
.aside-warning, .aside-deprecated, .aside-unavailable {
|
||||
border-left: 5px solid #ff6666; }
|
||||
.aside-warning .aside-title, .aside-deprecated .aside-title, .aside-unavailable .aside-title {
|
||||
color: #ff0000; }
|
||||
|
||||
.graybox {
|
||||
border-collapse: collapse;
|
||||
width: 100%; }
|
||||
.graybox p {
|
||||
margin: 0;
|
||||
word-break: break-word;
|
||||
min-width: 50px; }
|
||||
.graybox td {
|
||||
border: 1px solid #ddd;
|
||||
padding: 5px 25px 5px 10px;
|
||||
vertical-align: middle; }
|
||||
.graybox tr td:first-of-type {
|
||||
text-align: right;
|
||||
padding: 7px;
|
||||
vertical-align: top;
|
||||
word-break: normal;
|
||||
width: 40px; }
|
||||
|
||||
.slightly-smaller {
|
||||
font-size: 0.9em; }
|
||||
|
||||
.footer {
|
||||
padding: 8px 16px;
|
||||
background: #444;
|
||||
color: #ddd;
|
||||
font-size: 0.8em; }
|
||||
.footer p {
|
||||
margin: 8px 0; }
|
||||
.footer a {
|
||||
color: #fff; }
|
||||
|
||||
html.dash .header, html.dash .breadcrumbs, html.dash .navigation {
|
||||
display: none; }
|
||||
html.dash .height-container {
|
||||
display: block; }
|
||||
|
||||
form[role=search] input {
|
||||
font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
line-height: 24px;
|
||||
padding: 0 10px;
|
||||
margin: 0;
|
||||
border: none;
|
||||
border-radius: 1em; }
|
||||
.loading form[role=search] input {
|
||||
background: white url(../img/spinner.gif) center right 4px no-repeat; }
|
||||
form[role=search] .tt-menu {
|
||||
margin: 0;
|
||||
min-width: 300px;
|
||||
background: #fbfbfb;
|
||||
color: #333;
|
||||
border: 1px solid #ddd; }
|
||||
form[role=search] .tt-highlight {
|
||||
font-weight: bold; }
|
||||
form[role=search] .tt-suggestion {
|
||||
font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
padding: 0 8px; }
|
||||
form[role=search] .tt-suggestion span {
|
||||
display: table-cell;
|
||||
white-space: nowrap; }
|
||||
form[role=search] .tt-suggestion .doc-parent-name {
|
||||
width: 100%;
|
||||
text-align: right;
|
||||
font-weight: normal;
|
||||
font-size: 0.9em;
|
||||
padding-left: 16px; }
|
||||
form[role=search] .tt-suggestion:hover,
|
||||
form[role=search] .tt-suggestion.tt-cursor {
|
||||
cursor: pointer;
|
||||
background-color: #4183c4;
|
||||
color: #fff; }
|
||||
form[role=search] .tt-suggestion:hover .doc-parent-name,
|
||||
form[role=search] .tt-suggestion.tt-cursor .doc-parent-name {
|
||||
color: #fff; }
|
||||
|
Before Width: | Height: | Size: 274 B |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
@@ -1,118 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Logging Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="js/jquery.min.js" defer></script>
|
||||
<script src="js/jazzy.js" defer></script>
|
||||
|
||||
<script src="js/lunr.min.js" defer></script>
|
||||
<script src="js/typeahead.jquery.js" defer></script>
|
||||
<script src="js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<a title="Logging Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="index.html">
|
||||
Logging Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="index.html">Logging Reference</a>
|
||||
<img class="carat" src="img/carat.png" />
|
||||
Logging Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
|
||||
<h1 id='swiftlog-docs' class='heading'>SwiftLog Docs</h1>
|
||||
|
||||
<p>SwiftLog is a Swift logging API package.</p>
|
||||
|
||||
<p>To get started with SwiftLog, <a href="../Logging/index.html"><code>import Logging</code></a>. The
|
||||
most important type is <a href="https://apple.github.io/swift-log/docs/current/Logging/Structs/Logger.html"><code><a href="Structs/Logger.html">Logger</a></code></a>
|
||||
which you can use to emit log messages.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2019 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external">SwiftLog team</a>. All rights reserved. (Last updated: 2019-09-30)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.10.0</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,59 +0,0 @@
|
||||
window.jazzy = {'docset': false}
|
||||
if (typeof window.dash != 'undefined') {
|
||||
document.documentElement.className += ' dash'
|
||||
window.jazzy.docset = true
|
||||
}
|
||||
if (navigator.userAgent.match(/xcode/i)) {
|
||||
document.documentElement.className += ' xcode'
|
||||
window.jazzy.docset = true
|
||||
}
|
||||
|
||||
function toggleItem($link, $content) {
|
||||
var animationDuration = 300;
|
||||
$link.toggleClass('token-open');
|
||||
$content.slideToggle(animationDuration);
|
||||
}
|
||||
|
||||
function itemLinkToContent($link) {
|
||||
return $link.parent().parent().next();
|
||||
}
|
||||
|
||||
// On doc load + hash-change, open any targetted item
|
||||
function openCurrentItemIfClosed() {
|
||||
if (window.jazzy.docset) {
|
||||
return;
|
||||
}
|
||||
var $link = $(`.token[href="${location.hash}"]`);
|
||||
$content = itemLinkToContent($link);
|
||||
if ($content.is(':hidden')) {
|
||||
toggleItem($link, $content);
|
||||
}
|
||||
}
|
||||
|
||||
$(openCurrentItemIfClosed);
|
||||
$(window).on('hashchange', openCurrentItemIfClosed);
|
||||
|
||||
// On item link ('token') click, toggle its discussion
|
||||
$('.token').on('click', function(event) {
|
||||
if (window.jazzy.docset) {
|
||||
return;
|
||||
}
|
||||
var $link = $(this);
|
||||
toggleItem($link, itemLinkToContent($link));
|
||||
|
||||
// Keeps the document from jumping to the hash.
|
||||
var href = $link.attr('href');
|
||||
if (history.pushState) {
|
||||
history.pushState({}, '', href);
|
||||
} else {
|
||||
location.hash = href;
|
||||
}
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
// Clicks on links to the current, closed, item need to open the item
|
||||
$("a:not('.token')").on('click', function() {
|
||||
if (location == this.href) {
|
||||
openCurrentItemIfClosed();
|
||||
}
|
||||
});
|
||||
@@ -1,70 +0,0 @@
|
||||
$(function(){
|
||||
var $typeahead = $('[data-typeahead]');
|
||||
var $form = $typeahead.parents('form');
|
||||
var searchURL = $form.attr('action');
|
||||
|
||||
function displayTemplate(result) {
|
||||
return result.name;
|
||||
}
|
||||
|
||||
function suggestionTemplate(result) {
|
||||
var t = '<div class="list-group-item clearfix">';
|
||||
t += '<span class="doc-name">' + result.name + '</span>';
|
||||
if (result.parent_name) {
|
||||
t += '<span class="doc-parent-name label">' + result.parent_name + '</span>';
|
||||
}
|
||||
t += '</div>';
|
||||
return t;
|
||||
}
|
||||
|
||||
$typeahead.one('focus', function() {
|
||||
$form.addClass('loading');
|
||||
|
||||
$.getJSON(searchURL).then(function(searchData) {
|
||||
const searchIndex = lunr(function() {
|
||||
this.ref('url');
|
||||
this.field('name');
|
||||
this.field('abstract');
|
||||
for (const [url, doc] of Object.entries(searchData)) {
|
||||
this.add({url: url, name: doc.name, abstract: doc.abstract});
|
||||
}
|
||||
});
|
||||
|
||||
$typeahead.typeahead(
|
||||
{
|
||||
highlight: true,
|
||||
minLength: 3,
|
||||
autoselect: true
|
||||
},
|
||||
{
|
||||
limit: 10,
|
||||
display: displayTemplate,
|
||||
templates: { suggestion: suggestionTemplate },
|
||||
source: function(query, sync) {
|
||||
const lcSearch = query.toLowerCase();
|
||||
const results = searchIndex.query(function(q) {
|
||||
q.term(lcSearch, { boost: 100 });
|
||||
q.term(lcSearch, {
|
||||
boost: 10,
|
||||
wildcard: lunr.Query.wildcard.TRAILING
|
||||
});
|
||||
}).map(function(result) {
|
||||
var doc = searchData[result.ref];
|
||||
doc.url = result.ref;
|
||||
return doc;
|
||||
});
|
||||
sync(results);
|
||||
}
|
||||
}
|
||||
);
|
||||
$form.removeClass('loading');
|
||||
$typeahead.trigger('focus');
|
||||
});
|
||||
});
|
||||
|
||||
var baseURL = searchURL.slice(0, -"search.json".length);
|
||||
|
||||
$typeahead.on('typeahead:select', function(e, result) {
|
||||
window.location = baseURL + result.url;
|
||||
});
|
||||
});
|
||||
@@ -1,2 +0,0 @@
|
||||
/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */
|
||||
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function e(t){return"function"==typeof t&&"number"!=typeof t.nodeType},y=function e(t){return null!=t&&t===t.window},v={type:!0,src:!0,noModule:!0};function m(e,t,n){var i,o=(t=t||r).createElement("script");if(o.text=e,n)for(i in v)n[i]&&(o[i]=n[i]);t.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var b="3.3.1",w=function(e,t){return new w.fn.init(e,t)},T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;w.fn=w.prototype={jquery:"3.3.1",constructor:w,length:0,toArray:function(){return o.call(this)},get:function(e){return null==e?o.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return w.each(this,e)},map:function(e){return this.pushStack(w.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:n.sort,splice:n.splice},w.extend=w.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||g(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)n=a[t],a!==(r=e[t])&&(l&&r&&(w.isPlainObject(r)||(i=Array.isArray(r)))?(i?(i=!1,o=n&&Array.isArray(n)?n:[]):o=n&&w.isPlainObject(n)?n:{},a[t]=w.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},w.extend({expando:"jQuery"+("3.3.1"+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==c.call(e))&&(!(t=i(e))||"function"==typeof(n=f.call(t,"constructor")&&t.constructor)&&p.call(n)===d)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e){m(e)},each:function(e,t){var n,r=0;if(C(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(C(Object(e))?w.merge(n,"string"==typeof e?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:u.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r,i=[],o=0,a=e.length,s=!n;o<a;o++)(r=!t(e[o],o))!==s&&i.push(e[o]);return i},map:function(e,t,n){var r,i,o=0,s=[];if(C(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&s.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&s.push(i);return a.apply([],s)},guid:1,support:h}),"function"==typeof Symbol&&(w.fn[Symbol.iterator]=n[Symbol.iterator]),w.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function C(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!g(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}var E=function(e){var t,n,r,i,o,a,s,u,l,c,f,p,d,h,g,y,v,m,x,b="sizzle"+1*new Date,w=e.document,T=0,C=0,E=ae(),k=ae(),S=ae(),D=function(e,t){return e===t&&(f=!0),0},N={}.hasOwnProperty,A=[],j=A.pop,q=A.push,L=A.push,H=A.slice,O=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},P="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",I="\\["+M+"*("+R+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+R+"))|)"+M+"*\\]",W=":("+R+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+I+")*)|.*)\\)|)",$=new RegExp(M+"+","g"),B=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),F=new RegExp("^"+M+"*,"+M+"*"),_=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),z=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),X=new RegExp(W),U=new RegExp("^"+R+"$"),V={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+W),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)Line truncated
|
||||
@@ -1 +0,0 @@
|
||||
!function(){var t,l,c,e,r,h,d,f,p,y,m,g,x,v,w,Q,k,S,E,L,b,P,T,O,I,i,n,s,z=function(e){var t=new z.Builder;return t.pipeline.add(z.trimmer,z.stopWordFilter,z.stemmer),t.searchPipeline.add(z.stemmer),e.call(t,t),t.build()};z.version="2.3.5",z.utils={},z.utils.warn=(t=this,function(e){t.console&&console.warn&&console.warn(e)}),z.utils.asString=function(e){return null==e?"":e.toString()},z.utils.clone=function(e){if(null==e)return e;for(var t=Object.create(null),r=Object.keys(e),i=0;i<r.length;i++){var n=r[i],s=e[n];if(Array.isArray(s))t[n]=s.slice();else{if("string"!=typeof s&&"number"!=typeof s&&"boolean"!=typeof s)throw new TypeError("clone is not deep and does not support nested objects");t[n]=s}}return t},z.FieldRef=function(e,t,r){this.docRef=e,this.fieldName=t,this._stringValue=r},z.FieldRef.joiner="/",z.FieldRef.fromString=function(e){var t=e.indexOf(z.FieldRef.joiner);if(-1===t)throw"malformed field ref string";var r=e.slice(0,t),i=e.slice(t+1);return new z.FieldRef(i,r,e)},z.FieldRef.prototype.toString=function(){return null==this._stringValue&&(this._stringValue=this.fieldName+z.FieldRef.joiner+this.docRef),this._stringValue},z.Set=function(e){if(this.elements=Object.create(null),e){this.length=e.length;for(var t=0;t<this.length;t++)this.elements[e[t]]=!0}else this.length=0},z.Set.complete={intersect:function(e){return e},union:function(e){return e},contains:function(){return!0}},z.Set.empty={intersect:function(){return this},union:function(e){return e},contains:function(){return!1}},z.Set.prototype.contains=function(e){return!!this.elements[e]},z.Set.prototype.intersect=function(e){var t,r,i,n=[];if(e===z.Set.complete)return this;if(e===z.Set.empty)return e;r=this.length<e.length?(t=this,e):(t=e,this),i=Object.keys(t.elements);for(var s=0;s<i.length;s++){var o=i[s];o in r.elements&&n.push(o)}return new z.Set(n)},z.Set.prototype.union=function(e){return e===z.Set.complete?z.Set.complete:e===z.Set.empty?this:new z.Set(Object.keys(this.elements).concat(Object.keys(e.elements)))},z.idf=function(e,t){var r=0;for(var i in e)"_index"!=i&&(r+=Object.keys(e[i]).length);var n=(t-r+.5)/(r+.5);return Math.log(1+Math.abs(n))},z.Token=function(e,t){this.str=e||"",this.metadata=t||{}},z.Token.prototype.toString=function(){return this.str},z.Token.prototype.update=function(e){return this.str=e(this.str,this.metadata),this},z.Token.prototype.clone=function(e){return e=e||function(e){return e},new z.Token(e(this.str,this.metadata),this.metadata)},z.tokenizer=function(e,t){if(null==e||null==e)return[];if(Array.isArray(e))return e.map(function(e){return new z.Token(z.utils.asString(e).toLowerCase(),z.utils.clone(t))});for(var r=e.toString().trim().toLowerCase(),i=r.length,n=[],s=0,o=0;s<=i;s++){var a=s-o;if(r.charAt(s).match(z.tokenizer.separator)||s==i){if(0<a){var u=z.utils.clone(t)||{};u.position=[o,a],u.index=n.length,n.push(new z.Token(r.slice(o,s),u))}o=s+1}}return n},z.tokenizer.separator=/[\s\-]+/,z.Pipeline=function(){this._stack=[]},z.Pipeline.registeredFunctions=Object.create(null),z.Pipeline.registerFunction=function(e,t){t in this.registeredFunctions&&z.utils.warn("Overwriting existing registered function: "+t),e.label=t,z.Pipeline.registeredFunctions[e.label]=e},z.Pipeline.warnIfFunctionNotRegistered=function(e){e.label&&e.label in this.registeredFunctions||z.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},z.Pipeline.load=function(e){var r=new z.Pipeline;return e.forEach(function(e){var t=z.Pipeline.registeredFunctions[e];if(!t)throw new Error("Cannot load unregistered function: "+e);r.add(t)}),r},z.Pipeline.prototype.add=function(){Array.prototype.slice.call(arguments).forEach(function(e){z.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)},this)},z.Pipeline.prototype.after=function(e,t){z.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");r+=1,this._stack.splice(r,0,t)},z.Pipeline.prototype.before=function(e,t){z.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");this._stack.splice(r,0,t)},z.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);-1!=t&&this._stack.splice(t,1)},z.Pipeline.prototype.run=function(e){for(var t=this._stack.length,r=0;r<t;r++){for(var i=this._stack[r],n=[],s=0;s<e.length;s++){var o=i(e[s],s,e);if(void 0!==o&&""!==o)if(Array.isArray(o))for(var a=0;a<o.length;a++)n.push(o[a]);else n.push(o)}e=n}return e},z.Pipeline.prototype.runString=function(e,t){var r=new z.Token(e,t);return this.run([r]).map(function(e){return e.toString()})},z.Pipeline.prototype.reset=function(){this._stack=[]},z.Pipeline.prototype.toJSON=function(){return this._stack.map(function(e){return z.Pipeline.warnIfFunctionNotRegistered(e),e.label})},z.Vector=function(e){this._magnitude=0,this.elements=e||[]},z.Vector.prototype.positionForIndex=function(e){if(0==this.elements.length)return 0;Line truncated
|
||||
@@ -1 +0,0 @@
|
||||
{"Structs/StreamLogHandler.html#/s:7Logging16StreamLogHandlerV14standardOutput5labelACSS_tFZ":{"name":"standardOutput(label:)","abstract":"<p>Factory that makes a <code>StreamLogHandler</code> to directs its output to <code>stdout</code></p>","parent_name":"StreamLogHandler"},"Structs/StreamLogHandler.html#/s:7Logging16StreamLogHandlerV13standardError5labelACSS_tFZ":{"name":"standardError(label:)","abstract":"<p>Factory that makes a <code>StreamLogHandler</code> to directs its output to <code>stderr</code></p>","parent_name":"StreamLogHandler"},"Structs/StreamLogHandler.html#/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp":{"name":"logLevel","parent_name":"StreamLogHandler"},"Structs/StreamLogHandler.html#/s:7Logging10LogHandlerP8metadataSDySSAA6LoggerV13MetadataValueOGvp":{"name":"metadata","parent_name":"StreamLogHandler"},"Structs/StreamLogHandler.html#/s:7Logging10LogHandlerP11metadataKeyAA6LoggerV13MetadataValueOSgSS_tcip":{"name":"subscript(metadataKey:)","parent_name":"StreamLogHandler"},"Structs/StreamLogHandler.html#/s:7Logging10LogHandlerP3log5level7message8metadata4file8function4lineyAA6LoggerV5LevelO_AL7MessageVSDySSAL13MetadataValueOGSgS2SSutF":{"name":"log(level:message:metadata:file:function:line:)","parent_name":"StreamLogHandler"},"Structs/MultiplexLogHandler.html#/s:7Logging19MultiplexLogHandlerVyACSayAA0cD0_pGcfc":{"name":"init(_:)","abstract":"<p>Create a <code>MultiplexLogHandler</code>.</p>","parent_name":"MultiplexLogHandler"},"Structs/MultiplexLogHandler.html#/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp":{"name":"logLevel","parent_name":"MultiplexLogHandler"},"Structs/MultiplexLogHandler.html#/s:7Logging10LogHandlerP3log5level7message8metadata4file8function4lineyAA6LoggerV5LevelO_AL7MessageVSDySSAL13MetadataValueOGSgS2SSutF":{"name":"log(level:message:metadata:file:function:line:)","parent_name":"MultiplexLogHandler"},"Structs/MultiplexLogHandler.html#/s:7Logging10LogHandlerP8metadataSDySSAA6LoggerV13MetadataValueOGvp":{"name":"metadata","parent_name":"MultiplexLogHandler"},"Structs/MultiplexLogHandler.html#/s:7Logging10LogHandlerP11metadataKeyAA6LoggerV13MetadataValueOSgSS_tcip":{"name":"subscript(metadataKey:)","parent_name":"MultiplexLogHandler"},"Structs/Logger/Message.html#/s:s26ExpressibleByStringLiteralP0cD4TypeQa":{"name":"StringLiteralType","parent_name":"Message"},"Structs/Logger/Message.html#/s:s26ExpressibleByStringLiteralP06stringD0x0cD4TypeQz_tcfc":{"name":"init(stringLiteral:)","parent_name":"Message"},"Structs/Logger/Message.html#/s:s23CustomStringConvertibleP11descriptionSSvp":{"name":"description","parent_name":"Message"},"Structs/Logger/Level.html#/s:7Logging6LoggerV5LevelO5traceyA2EmF":{"name":"trace","abstract":"<p>Appropriate for messages that contain information only when debugging a program.</p>","parent_name":"Level"},"Structs/Logger/Level.html#/s:7Logging6LoggerV5LevelO5debugyA2EmF":{"name":"debug","abstract":"<p>Appropriate for messages that contain information normally of use only when","parent_name":"Level"},"Structs/Logger/Level.html#/s:7Logging6LoggerV5LevelO4infoyA2EmF":{"name":"info","abstract":"<p>Appropriate for informational messages.</p>","parent_name":"Level"},"Structs/Logger/Level.html#/s:7Logging6LoggerV5LevelO6noticeyA2EmF":{"name":"notice","abstract":"<p>Appropriate for conditions that are not error conditions, but that may require","parent_name":"Level"},"Structs/Logger/Level.html#/s:7Logging6LoggerV5LevelO7warningyA2EmF":{"name":"warning","abstract":"<p>Appropriate for messages that are not error conditions, but more severe than","parent_name":"Level"},"Structs/Logger/Level.html#/s:7Logging6LoggerV5LevelO5erroryA2EmF":{"name":"error","abstract":"<p>Appropriate for error conditions.</p>","parent_name":"Level"},"Structs/Logger/Level.html#/s:7Logging6LoggerV5LevelO8criticalyA2EmF":{"name":"critical","abstract":"<p>Appropriate for critical error conditions that usually require immediate","parent_name":"Level"},"Structs/Logger/Level.html#/s:SL1loiySbx_xtFZ":{"name":"<(_:_:)","parent_name":"Level"},"Structs/Logger/MetadataValue.html#/s:7Logging6LoggerV13MetadataValueO6stringyAESScAEmF":{"name":"string(_:)","abstract":"<p>A metadata value which is a <code>String</code>.</p>","parent_name":"MetadataValue"},"Structs/Logger/MetadataValue.html#/s:7Logging6LoggerV13MetadataValueO17stringConvertibleyAEs012CustomStringF0_pcAEmF":{"name":"stringConvertible(_:)","abstract":"<p>A metadata value which is some <code>CustomStringConvertible</code>.</p>","parent_name":"MetadataValue"},"Structs/Logger/MetadataValue.html#/s:7Logging6LoggerV13MetadataValueO10dictionaryyAESDySSAEGcAEmF":{"name":"dictionary(_:)","abstract":"<p>A metadata value which is a dictionary from <code>String</code> to <code>Logger.MetadataValue</code>.</p>","parent_name":"MetadataValue"},"Structs/Logger/MetadataValue.html#/s:7Logging6LoggerV13MetadataValueO5arrayyAESayAEGcAEmF":{"name":"array(_:)","abstract":"<p>A metadata value which is an array of <code>Logger.MetadataValue</code>sLine truncated
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"warnings": [
|
||||
|
||||
],
|
||||
"source_directory": "/code"
|
||||
}
|
||||
@@ -1,160 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Enumerations Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="js/jquery.min.js" defer></script>
|
||||
<script src="js/jazzy.js" defer></script>
|
||||
|
||||
<script src="js/lunr.min.js" defer></script>
|
||||
<script src="js/typeahead.jquery.js" defer></script>
|
||||
<script src="js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Section/Enumerations" class="dashAnchor"></a>
|
||||
|
||||
<a title="Enumerations Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="index.html">
|
||||
Logging 1.2.0 Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="dash-feed://https%3A%2F%2Fapple%2Egithub%2Eio%2Fswift%2Dlog%2Fdocs%2F1%2E2%2E0%2FLogging%2Fdocsets%2FLogging%2Exml">
|
||||
<img class="header-icon" src="img/dash.png"/>
|
||||
Install in Dash
|
||||
</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="index.html">Logging Reference</a>
|
||||
<img class="carat" src="img/carat.png" />
|
||||
Enumerations Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>Enumerations</h1>
|
||||
<p>The following enumerations are available globally.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging0A6SystemO"></a>
|
||||
<a name="//apple_ref/swift/Enum/LoggingSystem" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging0A6SystemO">LoggingSystem</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>The <code>LoggingSystem</code> is a global facility where the default logging backend implementation (<code><a href="Protocols/LogHandler.html">LogHandler</a></code>) can be
|
||||
configured. <code>LoggingSystem</code> is set up just once in a given program to set up the desired logging backend
|
||||
implementation.</p>
|
||||
|
||||
<a href="Enums/LoggingSystem.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">LoggingSystem</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L254-L279">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2020 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external">SwiftLog team</a>. All rights reserved. (Last updated: 2020-02-28)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,186 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>LoggingSystem Enumeration Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../js/jquery.min.js" defer></script>
|
||||
<script src="../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../js/lunr.min.js" defer></script>
|
||||
<script src="../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Enum/LoggingSystem" class="dashAnchor"></a>
|
||||
|
||||
<a title="LoggingSystem Enumeration Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
Logging 1.2.0 Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="dash-feed://https%3A%2F%2Fapple%2Egithub%2Eio%2Fswift%2Dlog%2Fdocs%2F1%2E2%2E0%2FLogging%2Fdocsets%2FLogging%2Exml">
|
||||
<img class="header-icon" src="../img/dash.png"/>
|
||||
Install in Dash
|
||||
</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">Logging Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
LoggingSystem Enumeration Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>LoggingSystem</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">LoggingSystem</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>The <code>LoggingSystem</code> is a global facility where the default logging backend implementation (<code><a href="../Protocols/LogHandler.html">LogHandler</a></code>) can be
|
||||
configured. <code>LoggingSystem</code> is set up just once in a given program to set up the desired logging backend
|
||||
implementation.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging0A6SystemO9bootstrapyyAA10LogHandler_pSScFZ"></a>
|
||||
<a name="//apple_ref/swift/Method/bootstrap(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging0A6SystemO9bootstrapyyAA10LogHandler_pSScFZ">bootstrap(_:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p><code>bootstrap</code> is a one-time configuration function which globally selects the desired logging backend
|
||||
implementation. <code>bootstrap</code> can be called at maximum once in any given program, calling it more than once will
|
||||
lead to undefined behaviour, most likely a crash.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="nf">bootstrap</span><span class="p">(</span><span class="n">_</span> <span class="nv">factory</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt"><a href="../Protocols/LogHandler.html">LogHandler</a></span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>factory</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>A closure that given a <code><a href="../Structs/Logger.html">Logger</a></code> identifier, produces an instance of the <code><a href="../Protocols/LogHandler.html">LogHandler</a></code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L265-L271">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2020 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external">SwiftLog team</a>. All rights reserved. (Last updated: 2020-02-28)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,251 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Protocols Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="js/jquery.min.js" defer></script>
|
||||
<script src="js/jazzy.js" defer></script>
|
||||
|
||||
<script src="js/lunr.min.js" defer></script>
|
||||
<script src="js/typeahead.jquery.js" defer></script>
|
||||
<script src="js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Section/Protocols" class="dashAnchor"></a>
|
||||
|
||||
<a title="Protocols Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="index.html">
|
||||
Logging 1.2.0 Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="dash-feed://https%3A%2F%2Fapple%2Egithub%2Eio%2Fswift%2Dlog%2Fdocs%2F1%2E2%2E0%2FLogging%2Fdocsets%2FLogging%2Exml">
|
||||
<img class="header-icon" src="img/dash.png"/>
|
||||
Install in Dash
|
||||
</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="index.html">Logging Reference</a>
|
||||
<img class="carat" src="img/carat.png" />
|
||||
Protocols Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>Protocols</h1>
|
||||
<p>The following protocols are available globally.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP"></a>
|
||||
<a name="//apple_ref/swift/Protocol/LogHandler" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP">LogHandler</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>A <code>LogHandler</code> is an implementation of a logging backend.</p>
|
||||
|
||||
<p>This type is an implementation detail and should not normally be used, unless implementing your own logging backend.
|
||||
To use the SwiftLog API, please refer to the documentation of <code><a href="Structs/Logger.html">Logger</a></code>.</p>
|
||||
<h1 id='implementation-requirements' class='heading'>Implementation requirements</h1>
|
||||
|
||||
<p>To implement your own <code>LogHandler</code> you should respect a few requirements that are necessary so applications work
|
||||
as expected regardless of the selected <code>LogHandler</code> implementation.</p>
|
||||
|
||||
<ul>
|
||||
<li>The <code>LogHandler</code> must be a <code>struct</code>.</li>
|
||||
<li>The metadata and <code>logLevel</code> properties must be implemented so that setting them on a <code><a href="Structs/Logger.html">Logger</a></code> does not affect
|
||||
other <code><a href="Structs/Logger.html">Logger</a></code>s.</li>
|
||||
</ul>
|
||||
<h3 id='treat-log-level-amp-metadata-as-values' class='heading'>Treat log level & metadata as values</h3>
|
||||
|
||||
<p>When developing your <code>LogHandler</code>, please make sure the following test works.</p>
|
||||
<pre class="highlight swift"><code><span class="kt">LoggingSystem</span><span class="o">.</span><span class="nf">bootstrap</span><span class="p">(</span><span class="kt">MyLogHandler</span><span class="o">.</span><span class="kd">init</span><span class="p">)</span> <span class="c1">// your LogHandler might have a different bootstrapping step</span>
|
||||
<span class="k">var</span> <span class="nv">logger1</span> <span class="o">=</span> <span class="kt">Logger</span><span class="p">(</span><span class="nv">label</span><span class="p">:</span> <span class="s">"first logger"</span><span class="p">)</span>
|
||||
<span class="n">logger1</span><span class="o">.</span><span class="n">logLevel</span> <span class="o">=</span> <span class="o">.</span><span class="n">debug</span>
|
||||
<span class="n">logger1</span><span class="p">[</span><span class="nv">metadataKey</span><span class="p">:</span> <span class="s">"only-on"</span><span class="p">]</span> <span class="o">=</span> <span class="s">"first"</span>
|
||||
|
||||
<span class="k">var</span> <span class="nv">logger2</span> <span class="o">=</span> <span class="n">logger1</span>
|
||||
<span class="n">logger2</span><span class="o">.</span><span class="n">logLevel</span> <span class="o">=</span> <span class="o">.</span><span class="n">error</span> <span class="c1">// this must not override `logger1`'s log level</span>
|
||||
<span class="n">logger2</span><span class="p">[</span><span class="nv">metadataKey</span><span class="p">:</span> <span class="s">"only-on"</span><span class="p">]</span> <span class="o">=</span> <span class="s">"second"</span> <span class="c1">// this must not override `logger1`'s metadata</span>
|
||||
|
||||
<span class="kt">XCTAssertEqual</span><span class="p">(</span><span class="o">.</span><span class="n">debug</span><span class="p">,</span> <span class="n">logger1</span><span class="o">.</span><span class="n">logLevel</span><span class="p">)</span>
|
||||
<span class="kt">XCTAssertEqual</span><span class="p">(</span><span class="o">.</span><span class="n">error</span><span class="p">,</span> <span class="n">logger2</span><span class="o">.</span><span class="n">logLevel</span><span class="p">)</span>
|
||||
<span class="kt">XCTAssertEqual</span><span class="p">(</span><span class="s">"first"</span><span class="p">,</span> <span class="n">logger1</span><span class="p">[</span><span class="nv">metadataKey</span><span class="p">:</span> <span class="s">"only-on"</span><span class="p">])</span>
|
||||
<span class="kt">XCTAssertEqual</span><span class="p">(</span><span class="s">"second"</span><span class="p">,</span> <span class="n">logger2</span><span class="p">[</span><span class="nv">metadataKey</span><span class="p">:</span> <span class="s">"only-on"</span><span class="p">])</span>
|
||||
</code></pre>
|
||||
<h3 id='special-cases' class='heading'>Special cases</h3>
|
||||
|
||||
<p>In certain special cases, the log level behaving like a value on <code><a href="Structs/Logger.html">Logger</a></code> might not be what you want. For example,
|
||||
you might want to set the log level across <em>all</em> <code><a href="Structs/Logger.html">Logger</a></code>s to <code>.debug</code> when say a signal (eg. <code>SIGUSR1</code>) is received
|
||||
to be able to debug special failures in production. This special case is acceptable but we urge you to create a
|
||||
solution specific to your <code>LogHandler</code> implementation to achieve that. Please find an example implementation of this
|
||||
behavior below, on reception of the signal you would call
|
||||
<code>LogHandlerWithGlobalLogLevelOverride.overrideGlobalLogLevel = .debug</code>, for example.</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="p">:</span> <span class="kt">LogHandler</span> <span class="p">{</span>
|
||||
<span class="c1">// the static properties hold the globally overridden log level (if overridden)</span>
|
||||
<span class="kd">private</span> <span class="kd">static</span> <span class="k">let</span> <span class="nv">overrideLock</span> <span class="o">=</span> <span class="kt">Lock</span><span class="p">()</span>
|
||||
<span class="kd">private</span> <span class="kd">static</span> <span class="k">var</span> <span class="nv">overrideLogLevel</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span>
|
||||
|
||||
<span class="c1">// this holds the log level if not overridden</span>
|
||||
<span class="kd">private</span> <span class="k">var</span> <span class="nv">_logLevel</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span> <span class="o">=</span> <span class="o">.</span><span class="n">info</span>
|
||||
|
||||
<span class="c1">// metadata storage</span>
|
||||
<span class="kd">public</span> <span class="k">var</span> <span class="nv">metadata</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Metadata</span> <span class="o">=</span> <span class="p">[:]</span>
|
||||
|
||||
<span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">label</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="p">{</span>
|
||||
<span class="c1">// [...]</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="kd">public</span> <span class="k">var</span> <span class="nv">logLevel</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span> <span class="p">{</span>
|
||||
<span class="c1">// when we get asked for the log level, we check if it was globally overridden or not</span>
|
||||
<span class="k">get</span> <span class="p">{</span>
|
||||
<span class="k">return</span> <span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLock</span><span class="o">.</span><span class="n">withLock</span> <span class="p">{</span>
|
||||
<span class="k">return</span> <span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLogLevel</span>
|
||||
<span class="p">}</span> <span class="p">??</span> <span class="k">self</span><span class="o">.</span><span class="n">_logLevel</span>
|
||||
<span class="p">}</span>
|
||||
<span class="c1">// we set the log level whenever we're asked (note: this might not have an effect if globally</span>
|
||||
<span class="c1">// overridden)</span>
|
||||
<span class="k">set</span> <span class="p">{</span>
|
||||
<span class="k">self</span><span class="o">.</span><span class="n">_logLevel</span> <span class="o">=</span> <span class="n">newValue</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">log</span><span class="p">(</span><span class="nv">level</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span><span class="p">,</span> <span class="nv">message</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Message</span><span class="p">,</span> <span class="nv">metadata</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Metadata</span><span class="p">?,</span>
|
||||
<span class="nv">file</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">function</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">line</span><span class="p">:</span> <span class="kt">UInt</span><span class="p">)</span> <span class="p">{</span>
|
||||
<span class="c1">// [...]</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="kd">public</span> <span class="nf">subscript</span><span class="p">(</span><span class="n">metadataKey</span> <span class="nv">metadataKey</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Metadata</span><span class="o">.</span><span class="kt">Value</span><span class="p">?</span> <span class="p">{</span>
|
||||
<span class="k">get</span> <span class="p">{</span>
|
||||
<span class="k">return</span> <span class="k">self</span><span class="o">.</span><span class="n">metadata</span><span class="p">[</span><span class="n">metadataKey</span><span class="p">]</span>
|
||||
<span class="p">}</span>
|
||||
<span class="nf">set</span><span class="p">(</span><span class="n">newValue</span><span class="p">)</span> <span class="p">{</span>
|
||||
<span class="k">self</span><span class="o">.</span><span class="n">metadata</span><span class="p">[</span><span class="n">metadataKey</span><span class="p">]</span> <span class="o">=</span> <span class="n">newValue</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="c1">// this is the function to globally override the log level, it is not part of the `LogHandler` protocol</span>
|
||||
<span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="nf">overrideGlobalLogLevel</span><span class="p">(</span><span class="n">_</span> <span class="nv">logLevel</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span><span class="p">)</span> <span class="p">{</span>
|
||||
<span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLock</span><span class="o">.</span><span class="n">withLock</span> <span class="p">{</span>
|
||||
<span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLogLevel</span> <span class="o">=</span> <span class="n">logLevel</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre>
|
||||
|
||||
<p>Please note that the above <code>LogHandler</code> will still pass the ‘log level is a value’ test above it iff the global log
|
||||
level has not been overridden. And most importantly it passes the requirement listed above: A change to the log
|
||||
level on one <code><a href="Structs/Logger.html">Logger</a></code> should not affect the log level of another <code><a href="Structs/Logger.html">Logger</a></code> variable.</p>
|
||||
|
||||
<a href="Protocols/LogHandler.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">LogHandler</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/LogHandler.swift#L114-L153">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2020 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external">SwiftLog team</a>. All rights reserved. (Last updated: 2020-02-28)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,466 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>LogHandler Protocol Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../js/jquery.min.js" defer></script>
|
||||
<script src="../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../js/lunr.min.js" defer></script>
|
||||
<script src="../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Protocol/LogHandler" class="dashAnchor"></a>
|
||||
|
||||
<a title="LogHandler Protocol Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
Logging 1.2.0 Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="dash-feed://https%3A%2F%2Fapple%2Egithub%2Eio%2Fswift%2Dlog%2Fdocs%2F1%2E2%2E0%2FLogging%2Fdocsets%2FLogging%2Exml">
|
||||
<img class="header-icon" src="../img/dash.png"/>
|
||||
Install in Dash
|
||||
</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">Logging Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
LogHandler Protocol Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>LogHandler</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">LogHandler</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>A <code>LogHandler</code> is an implementation of a logging backend.</p>
|
||||
|
||||
<p>This type is an implementation detail and should not normally be used, unless implementing your own logging backend.
|
||||
To use the SwiftLog API, please refer to the documentation of <code><a href="../Structs/Logger.html">Logger</a></code>.</p>
|
||||
<h1 id='implementation-requirements' class='heading'>Implementation requirements</h1>
|
||||
|
||||
<p>To implement your own <code>LogHandler</code> you should respect a few requirements that are necessary so applications work
|
||||
as expected regardless of the selected <code>LogHandler</code> implementation.</p>
|
||||
|
||||
<ul>
|
||||
<li>The <code>LogHandler</code> must be a <code>struct</code>.</li>
|
||||
<li>The metadata and <code>logLevel</code> properties must be implemented so that setting them on a <code><a href="../Structs/Logger.html">Logger</a></code> does not affect
|
||||
other <code><a href="../Structs/Logger.html">Logger</a></code>s.</li>
|
||||
</ul>
|
||||
<h3 id='treat-log-level-amp-metadata-as-values' class='heading'>Treat log level & metadata as values</h3>
|
||||
|
||||
<p>When developing your <code>LogHandler</code>, please make sure the following test works.</p>
|
||||
<pre class="highlight swift"><code><span class="kt">LoggingSystem</span><span class="o">.</span><span class="nf">bootstrap</span><span class="p">(</span><span class="kt">MyLogHandler</span><span class="o">.</span><span class="kd">init</span><span class="p">)</span> <span class="c1">// your LogHandler might have a different bootstrapping step</span>
|
||||
<span class="k">var</span> <span class="nv">logger1</span> <span class="o">=</span> <span class="kt">Logger</span><span class="p">(</span><span class="nv">label</span><span class="p">:</span> <span class="s">"first logger"</span><span class="p">)</span>
|
||||
<span class="n">logger1</span><span class="o">.</span><span class="n">logLevel</span> <span class="o">=</span> <span class="o">.</span><span class="n">debug</span>
|
||||
<span class="n">logger1</span><span class="p">[</span><span class="nv">metadataKey</span><span class="p">:</span> <span class="s">"only-on"</span><span class="p">]</span> <span class="o">=</span> <span class="s">"first"</span>
|
||||
|
||||
<span class="k">var</span> <span class="nv">logger2</span> <span class="o">=</span> <span class="n">logger1</span>
|
||||
<span class="n">logger2</span><span class="o">.</span><span class="n">logLevel</span> <span class="o">=</span> <span class="o">.</span><span class="n">error</span> <span class="c1">// this must not override `logger1`'s log level</span>
|
||||
<span class="n">logger2</span><span class="p">[</span><span class="nv">metadataKey</span><span class="p">:</span> <span class="s">"only-on"</span><span class="p">]</span> <span class="o">=</span> <span class="s">"second"</span> <span class="c1">// this must not override `logger1`'s metadata</span>
|
||||
|
||||
<span class="kt">XCTAssertEqual</span><span class="p">(</span><span class="o">.</span><span class="n">debug</span><span class="p">,</span> <span class="n">logger1</span><span class="o">.</span><span class="n">logLevel</span><span class="p">)</span>
|
||||
<span class="kt">XCTAssertEqual</span><span class="p">(</span><span class="o">.</span><span class="n">error</span><span class="p">,</span> <span class="n">logger2</span><span class="o">.</span><span class="n">logLevel</span><span class="p">)</span>
|
||||
<span class="kt">XCTAssertEqual</span><span class="p">(</span><span class="s">"first"</span><span class="p">,</span> <span class="n">logger1</span><span class="p">[</span><span class="nv">metadataKey</span><span class="p">:</span> <span class="s">"only-on"</span><span class="p">])</span>
|
||||
<span class="kt">XCTAssertEqual</span><span class="p">(</span><span class="s">"second"</span><span class="p">,</span> <span class="n">logger2</span><span class="p">[</span><span class="nv">metadataKey</span><span class="p">:</span> <span class="s">"only-on"</span><span class="p">])</span>
|
||||
</code></pre>
|
||||
<h3 id='special-cases' class='heading'>Special cases</h3>
|
||||
|
||||
<p>In certain special cases, the log level behaving like a value on <code><a href="../Structs/Logger.html">Logger</a></code> might not be what you want. For example,
|
||||
you might want to set the log level across <em>all</em> <code><a href="../Structs/Logger.html">Logger</a></code>s to <code>.debug</code> when say a signal (eg. <code>SIGUSR1</code>) is received
|
||||
to be able to debug special failures in production. This special case is acceptable but we urge you to create a
|
||||
solution specific to your <code>LogHandler</code> implementation to achieve that. Please find an example implementation of this
|
||||
behavior below, on reception of the signal you would call
|
||||
<code>LogHandlerWithGlobalLogLevelOverride.overrideGlobalLogLevel = .debug</code>, for example.</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="p">:</span> <span class="kt">LogHandler</span> <span class="p">{</span>
|
||||
<span class="c1">// the static properties hold the globally overridden log level (if overridden)</span>
|
||||
<span class="kd">private</span> <span class="kd">static</span> <span class="k">let</span> <span class="nv">overrideLock</span> <span class="o">=</span> <span class="kt">Lock</span><span class="p">()</span>
|
||||
<span class="kd">private</span> <span class="kd">static</span> <span class="k">var</span> <span class="nv">overrideLogLevel</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span>
|
||||
|
||||
<span class="c1">// this holds the log level if not overridden</span>
|
||||
<span class="kd">private</span> <span class="k">var</span> <span class="nv">_logLevel</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span> <span class="o">=</span> <span class="o">.</span><span class="n">info</span>
|
||||
|
||||
<span class="c1">// metadata storage</span>
|
||||
<span class="kd">public</span> <span class="k">var</span> <span class="nv">metadata</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Metadata</span> <span class="o">=</span> <span class="p">[:]</span>
|
||||
|
||||
<span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">label</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="p">{</span>
|
||||
<span class="c1">// [...]</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="kd">public</span> <span class="k">var</span> <span class="nv">logLevel</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span> <span class="p">{</span>
|
||||
<span class="c1">// when we get asked for the log level, we check if it was globally overridden or not</span>
|
||||
<span class="k">get</span> <span class="p">{</span>
|
||||
<span class="k">return</span> <span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLock</span><span class="o">.</span><span class="n">withLock</span> <span class="p">{</span>
|
||||
<span class="k">return</span> <span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLogLevel</span>
|
||||
<span class="p">}</span> <span class="p">??</span> <span class="k">self</span><span class="o">.</span><span class="n">_logLevel</span>
|
||||
<span class="p">}</span>
|
||||
<span class="c1">// we set the log level whenever we're asked (note: this might not have an effect if globally</span>
|
||||
<span class="c1">// overridden)</span>
|
||||
<span class="k">set</span> <span class="p">{</span>
|
||||
<span class="k">self</span><span class="o">.</span><span class="n">_logLevel</span> <span class="o">=</span> <span class="n">newValue</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">log</span><span class="p">(</span><span class="nv">level</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span><span class="p">,</span> <span class="nv">message</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Message</span><span class="p">,</span> <span class="nv">metadata</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Metadata</span><span class="p">?,</span>
|
||||
<span class="nv">file</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">function</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">line</span><span class="p">:</span> <span class="kt">UInt</span><span class="p">)</span> <span class="p">{</span>
|
||||
<span class="c1">// [...]</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="kd">public</span> <span class="nf">subscript</span><span class="p">(</span><span class="n">metadataKey</span> <span class="nv">metadataKey</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Metadata</span><span class="o">.</span><span class="kt">Value</span><span class="p">?</span> <span class="p">{</span>
|
||||
<span class="k">get</span> <span class="p">{</span>
|
||||
<span class="k">return</span> <span class="k">self</span><span class="o">.</span><span class="n">metadata</span><span class="p">[</span><span class="n">metadataKey</span><span class="p">]</span>
|
||||
<span class="p">}</span>
|
||||
<span class="nf">set</span><span class="p">(</span><span class="n">newValue</span><span class="p">)</span> <span class="p">{</span>
|
||||
<span class="k">self</span><span class="o">.</span><span class="n">metadata</span><span class="p">[</span><span class="n">metadataKey</span><span class="p">]</span> <span class="o">=</span> <span class="n">newValue</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="c1">// this is the function to globally override the log level, it is not part of the `LogHandler` protocol</span>
|
||||
<span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="nf">overrideGlobalLogLevel</span><span class="p">(</span><span class="n">_</span> <span class="nv">logLevel</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span><span class="p">)</span> <span class="p">{</span>
|
||||
<span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLock</span><span class="o">.</span><span class="n">withLock</span> <span class="p">{</span>
|
||||
<span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLogLevel</span> <span class="o">=</span> <span class="n">logLevel</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre>
|
||||
|
||||
<p>Please note that the above <code>LogHandler</code> will still pass the ‘log level is a value’ test above it iff the global log
|
||||
level has not been overridden. And most importantly it passes the requirement listed above: A change to the log
|
||||
level on one <code><a href="../Structs/Logger.html">Logger</a></code> should not affect the log level of another <code><a href="../Structs/Logger.html">Logger</a></code> variable.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP3log5level7message8metadata4file8function4lineyAA6LoggerV5LevelO_AL7MessageVSDySSAL13MetadataValueOGSgS2SSutF"></a>
|
||||
<a name="//apple_ref/swift/Method/log(level:message:metadata:file:function:line:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP3log5level7message8metadata4file8function4lineyAA6LoggerV5LevelO_AL7MessageVSDySSAL13MetadataValueOGSgS2SSutF">log(level:message:metadata:file:function:line:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>This method is called when a <code>LogHandler</code> must emit a log message. There is no need for the <code>LogHandler</code> to
|
||||
check if the <code>level</code> is above or below the configured <code><a href="../Protocols/LogHandler.html#/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp">logLevel</a></code> as <code><a href="../Structs/Logger.html">Logger</a></code> already performed this check and
|
||||
determined that a message should be logged.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">log</span><span class="p">(</span><span class="nv">level</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span><span class="p">,</span> <span class="nv">message</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Message</span><span class="p">,</span> <span class="nv">metadata</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span><span class="p">?,</span> <span class="nv">file</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">function</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">line</span><span class="p">:</span> <span class="kt">UInt</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>level</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The log level the message was logged at.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>message</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The message to log. To obtain a <code>String</code> representation call <code>message.description</code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>metadata</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The metadata associated to this log message.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>file</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The file the log message was emitted from.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>function</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The function the log line was emitted from.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>line</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The line the log message was emitted from.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/LogHandler.swift#L126">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP11metadataKeyAA6LoggerV13MetadataValueOSgSS_tcip"></a>
|
||||
<a name="//apple_ref/swift/Method/subscript(metadataKey:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP11metadataKeyAA6LoggerV13MetadataValueOSgSS_tcip">subscript(metadataKey:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Add, remove, or change the logging metadata.</p>
|
||||
<div class="aside aside-note">
|
||||
<p class="aside-title">Note</p>
|
||||
<p><code>LogHandler</code>s must treat logging metadata as a value type. This means that the change in metadata must
|
||||
only affect this very <code>LogHandler</code>.</p>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="nf">subscript</span><span class="p">(</span><span class="n">metadataKey</span> <span class="nv">_</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span><span class="o">.</span><span class="kt">Value</span><span class="p">?</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>metadataKey</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The key for the metadata item</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/LogHandler.swift#L138">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP8metadataSDySSAA6LoggerV13MetadataValueOGvp"></a>
|
||||
<a name="//apple_ref/swift/Property/metadata" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP8metadataSDySSAA6LoggerV13MetadataValueOGvp">metadata</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Get or set the entire metadata storage as a dictionary.</p>
|
||||
<div class="aside aside-note">
|
||||
<p class="aside-title">Note</p>
|
||||
<code>LogHandler</code>s must treat logging metadata as a value type. This means that the change in metadata must
|
||||
only affect this very <code>LogHandler</code>.
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">var</span> <span class="nv">metadata</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/LogHandler.swift#L144">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp"></a>
|
||||
<a name="//apple_ref/swift/Property/logLevel" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp">logLevel</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Get or set the configured log level.</p>
|
||||
<div class="aside aside-note">
|
||||
<p class="aside-title">Note</p>
|
||||
<code>LogHandler</code>s must treat the log level as a value type. This means that the change in metadata must
|
||||
only affect this very <code>LogHandler</code>. It is acceptable to provide some form of global log level override
|
||||
that means a change in log level on a particular <code>LogHandler</code> might not be reflected in any
|
||||
<code>LogHandler</code>.
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">var</span> <span class="nv">logLevel</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/LogHandler.swift#L152">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2020 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external">SwiftLog team</a>. All rights reserved. (Last updated: 2020-02-28)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,230 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Structures Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="js/jquery.min.js" defer></script>
|
||||
<script src="js/jazzy.js" defer></script>
|
||||
|
||||
<script src="js/lunr.min.js" defer></script>
|
||||
<script src="js/typeahead.jquery.js" defer></script>
|
||||
<script src="js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Section/Structures" class="dashAnchor"></a>
|
||||
|
||||
<a title="Structures Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="index.html">
|
||||
Logging 1.2.0 Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="dash-feed://https%3A%2F%2Fapple%2Egithub%2Eio%2Fswift%2Dlog%2Fdocs%2F1%2E2%2E0%2FLogging%2Fdocsets%2FLogging%2Exml">
|
||||
<img class="header-icon" src="img/dash.png"/>
|
||||
Install in Dash
|
||||
</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="index.html">Logging Reference</a>
|
||||
<img class="carat" src="img/carat.png" />
|
||||
Structures Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>Structures</h1>
|
||||
<p>The following structures are available globally.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV"></a>
|
||||
<a name="//apple_ref/swift/Struct/Logger" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV">Logger</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>A <code>Logger</code> is the central type in <code>SwiftLog</code>. Its central function is to emit log messages using one of the methods
|
||||
corresponding to a log level.</p>
|
||||
|
||||
<p>The most basic usage of a <code>Logger</code> is</p>
|
||||
<pre class="highlight swift"><code><span class="n">logger</span><span class="o">.</span><span class="nf">info</span><span class="p">(</span><span class="s">"Hello World!"</span><span class="p">)</span>
|
||||
</code></pre>
|
||||
|
||||
<a href="Structs/Logger.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Logger</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L30-L41">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging19MultiplexLogHandlerV"></a>
|
||||
<a name="//apple_ref/swift/Struct/MultiplexLogHandler" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging19MultiplexLogHandlerV">MultiplexLogHandler</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>A pseudo-<code><a href="Protocols/LogHandler.html">LogHandler</a></code> that can be used to send messages to multiple other <code><a href="Protocols/LogHandler.html">LogHandler</a></code>s.</p>
|
||||
|
||||
<p>The first <code><a href="Protocols/LogHandler.html">LogHandler</a></code> passed to the initialisation function of <code>MultiplexLogHandler</code> control the <code>logLevel</code> as
|
||||
well as the <code>metadata</code> for this <code><a href="Protocols/LogHandler.html">LogHandler</a></code>. Any subsequent <code><a href="Protocols/LogHandler.html">LogHandler</a></code>s used to initialise a
|
||||
<code>MultiplexLogHandler</code> are merely to emit the log message to another place.</p>
|
||||
|
||||
<a href="Structs/MultiplexLogHandler.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">MultiplexLogHandler</span> <span class="p">:</span> <span class="kt"><a href="Protocols/LogHandler.html">LogHandler</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L466-L522">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging16StreamLogHandlerV"></a>
|
||||
<a name="//apple_ref/swift/Struct/StreamLogHandler" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging16StreamLogHandlerV">StreamLogHandler</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p><code>StreamLogHandler</code> is a simple implementation of <code><a href="Protocols/LogHandler.html">LogHandler</a></code> for directing
|
||||
<code><a href="Structs/Logger.html">Logger</a></code> output to either <code>stderr</code> or <code>stdout</code> via the factory methods.</p>
|
||||
|
||||
<a href="Structs/StreamLogHandler.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">StreamLogHandler</span> <span class="p">:</span> <span class="kt"><a href="Protocols/LogHandler.html">LogHandler</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L582-L647">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2020 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external">SwiftLog team</a>. All rights reserved. (Last updated: 2020-02-28)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,384 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Level Enumeration Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../../js/jquery.min.js" defer></script>
|
||||
<script src="../../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../../js/lunr.min.js" defer></script>
|
||||
<script src="../../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Enum/Level" class="dashAnchor"></a>
|
||||
|
||||
<a title="Level Enumeration Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../../index.html">
|
||||
Logging 1.2.0 Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="../../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="dash-feed://https%3A%2F%2Fapple%2Egithub%2Eio%2Fswift%2Dlog%2Fdocs%2F1%2E2%2E0%2FLogging%2Fdocsets%2FLogging%2Exml">
|
||||
<img class="header-icon" src="../../img/dash.png"/>
|
||||
Install in Dash
|
||||
</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../../index.html">Logging Reference</a>
|
||||
<img class="carat" src="../../img/carat.png" />
|
||||
Level Enumeration Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>Level</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Level</span> <span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="kt">Codable</span><span class="p">,</span> <span class="kt">CaseIterable</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span><span class="p">:</span> <span class="kt">Comparable</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>The log level.</p>
|
||||
|
||||
<p>Log levels are ordered by their severity, with <code>.trace</code> being the least severe and
|
||||
<code>.critical</code> being the most severe.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV5LevelO5traceyA2EmF"></a>
|
||||
<a name="//apple_ref/swift/Element/trace" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV5LevelO5traceyA2EmF">trace</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Appropriate for messages that contain information only when debugging a program.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">trace</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L327">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV5LevelO5debugyA2EmF"></a>
|
||||
<a name="//apple_ref/swift/Element/debug" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV5LevelO5debugyA2EmF">debug</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Appropriate for messages that contain information normally of use only when
|
||||
debugging a program.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">debug</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L331">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV5LevelO4infoyA2EmF"></a>
|
||||
<a name="//apple_ref/swift/Element/info" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV5LevelO4infoyA2EmF">info</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Appropriate for informational messages.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">info</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L334">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV5LevelO6noticeyA2EmF"></a>
|
||||
<a name="//apple_ref/swift/Element/notice" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV5LevelO6noticeyA2EmF">notice</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Appropriate for conditions that are not error conditions, but that may require
|
||||
special handling.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">notice</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L338">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV5LevelO7warningyA2EmF"></a>
|
||||
<a name="//apple_ref/swift/Element/warning" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV5LevelO7warningyA2EmF">warning</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Appropriate for messages that are not error conditions, but more severe than
|
||||
<code><a href="../../Structs/Logger/Level.html#/s:7Logging6LoggerV5LevelO6noticeyA2EmF">.notice</a></code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">warning</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L342">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV5LevelO5erroryA2EmF"></a>
|
||||
<a name="//apple_ref/swift/Element/error" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV5LevelO5erroryA2EmF">error</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Appropriate for error conditions.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">error</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L345">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV5LevelO8criticalyA2EmF"></a>
|
||||
<a name="//apple_ref/swift/Element/critical" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV5LevelO8criticalyA2EmF">critical</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Appropriate for critical error conditions that usually require immediate
|
||||
attention.</p>
|
||||
|
||||
<p>When a <code>critical</code> message is logged, the logging backend (<code><a href="../../Protocols/LogHandler.html">LogHandler</a></code>) is free to perform
|
||||
more heavy-weight operations to capture system state (such as capturing stack traces) to facilitate
|
||||
debugging.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">critical</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L353">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:SL1loiySbx_xtFZ"></a>
|
||||
<a name="//apple_ref/swift/Method/<(_:_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:SL1loiySbx_xtFZ"><(_:_:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o"><</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span><span class="p">,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span><span class="p">)</span> <span class="o">-></span> <span class="kt">Bool</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L405-L407">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2020 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external">SwiftLog team</a>. All rights reserved. (Last updated: 2020-02-28)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,232 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Message Structure Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../../js/jquery.min.js" defer></script>
|
||||
<script src="../../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../../js/lunr.min.js" defer></script>
|
||||
<script src="../../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Struct/Message" class="dashAnchor"></a>
|
||||
|
||||
<a title="Message Structure Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../../index.html">
|
||||
Logging 1.2.0 Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="../../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="dash-feed://https%3A%2F%2Fapple%2Egithub%2Eio%2Fswift%2Dlog%2Fdocs%2F1%2E2%2E0%2FLogging%2Fdocsets%2FLogging%2Exml">
|
||||
<img class="header-icon" src="../../img/dash.png"/>
|
||||
Install in Dash
|
||||
</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../../index.html">Logging Reference</a>
|
||||
<img class="carat" src="../../img/carat.png" />
|
||||
Message Structure Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>Message</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Message</span><span class="p">:</span> <span class="kt">ExpressibleByStringLiteral</span><span class="p">,</span>
|
||||
<span class="kt">Equatable</span><span class="p">,</span>
|
||||
<span class="kt">CustomStringConvertible</span><span class="p">,</span>
|
||||
<span class="kt">ExpressibleByStringInterpolation</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p><code>Logger.Message</code> represents a log message’s text. It is usually created using string literals.</p>
|
||||
|
||||
<p>Example creating a <code>Logger.Message</code>:</p>
|
||||
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">world</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"world"</span>
|
||||
<span class="k">let</span> <span class="nv">myLogMessage</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Message</span> <span class="o">=</span> <span class="s">"Hello </span><span class="se">\(</span><span class="n">world</span><span class="se">)</span><span class="s">"</span>
|
||||
</code></pre>
|
||||
|
||||
<p>Most commonly, <code>Logger.Message</code>s appear simply as the parameter to a logging method such as:</p>
|
||||
<pre class="highlight swift"><code><span class="n">logger</span><span class="o">.</span><span class="nf">info</span><span class="p">(</span><span class="s">"Hello </span><span class="se">\(</span><span class="n">world</span><span class="se">)</span><span class="s">"</span><span class="p">)</span>
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s26ExpressibleByStringLiteralP0cD4TypeQa"></a>
|
||||
<a name="//apple_ref/swift/Alias/StringLiteralType" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s26ExpressibleByStringLiteralP0cD4TypeQa">StringLiteralType</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">StringLiteralType</span> <span class="o">=</span> <span class="kt">String</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s26ExpressibleByStringLiteralP06stringD0x0cD4TypeQz_tcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(stringLiteral:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s26ExpressibleByStringLiteralP06stringD0x0cD4TypeQz_tcfc">init(stringLiteral:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">stringLiteral</span> <span class="nv">value</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L451-L453">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s23CustomStringConvertibleP11descriptionSSvp"></a>
|
||||
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s23CustomStringConvertibleP11descriptionSSvp">description</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L455-L457">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2020 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external">SwiftLog team</a>. All rights reserved. (Last updated: 2020-02-28)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,544 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>MetadataValue Enumeration Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../../js/jquery.min.js" defer></script>
|
||||
<script src="../../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../../js/lunr.min.js" defer></script>
|
||||
<script src="../../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Enum/MetadataValue" class="dashAnchor"></a>
|
||||
|
||||
<a title="MetadataValue Enumeration Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../../index.html">
|
||||
Logging 1.2.0 Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="../../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="dash-feed://https%3A%2F%2Fapple%2Egithub%2Eio%2Fswift%2Dlog%2Fdocs%2F1%2E2%2E0%2FLogging%2Fdocsets%2FLogging%2Exml">
|
||||
<img class="header-icon" src="../../img/dash.png"/>
|
||||
Install in Dash
|
||||
</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../../index.html">Logging Reference</a>
|
||||
<img class="carat" src="../../img/carat.png" />
|
||||
MetadataValue Enumeration Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>MetadataValue</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">MetadataValue</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">MetadataValue</span><span class="p">:</span> <span class="kt">Equatable</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">MetadataValue</span><span class="p">:</span> <span class="kt">ExpressibleByStringLiteral</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">MetadataValue</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">MetadataValue</span><span class="p">:</span> <span class="kt">ExpressibleByStringInterpolation</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">MetadataValue</span><span class="p">:</span> <span class="kt">ExpressibleByDictionaryLiteral</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">MetadataValue</span><span class="p">:</span> <span class="kt">ExpressibleByArrayLiteral</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>A logging metadata value. <code>Logger.MetadataValue</code> is string, array, and dictionary literal convertible.</p>
|
||||
|
||||
<p><code>MetadataValue</code> provides convenient conformances to <code>ExpressibleByStringInterpolation</code>,
|
||||
<code>ExpressibleByStringLiteral</code>, <code>ExpressibleByArrayLiteral</code>, and <code>ExpressibleByDictionaryLiteral</code> which means
|
||||
that when constructing <code>MetadataValue</code>s you should default to using Swift’s usual literals.</p>
|
||||
|
||||
<p>Examples:</p>
|
||||
|
||||
<ul>
|
||||
<li>prefer <code>logger.info("user logged in", metadata: ["user-id": "\(user.id)"])</code> over
|
||||
<code>..., metadata: ["user-id": .string(user.id.description)])</code></li>
|
||||
<li>prefer <code>logger.info("user selected colours", metadata: ["colors": ["\(user.topColor)", "\(user.secondColor)"]])</code>
|
||||
over <code>..., metadata: ["colors": .array([.string("\(user.topColor)"), .string("\(user.secondColor)")])</code></li>
|
||||
<li>prefer <code>logger.info("nested info", metadata: ["nested": ["fave-numbers": ["\(1)", "\(2)", "\(3)"], "foo": "bar"]])</code>
|
||||
over <code>..., metadata: ["nested": .dictionary(["fave-numbers": ...])])</code></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV13MetadataValueO6stringyAESScAEmF"></a>
|
||||
<a name="//apple_ref/swift/Element/string(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV13MetadataValueO6stringyAESScAEmF">string(_:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>A metadata value which is a <code>String</code>.</p>
|
||||
|
||||
<p>Because <code>MetadataValue</code> implements <code>ExpressibleByStringInterpolation</code>, and <code>ExpressibleByStringLiteral</code>,
|
||||
you don’t need to type <code>.string(someType.description)</code> you can use the string interpolation <code>"\(someType)"</code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">string</span><span class="p">(</span><span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L303">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV13MetadataValueO17stringConvertibleyAEs012CustomStringF0_pcAEmF"></a>
|
||||
<a name="//apple_ref/swift/Element/stringConvertible(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV13MetadataValueO17stringConvertibleyAEs012CustomStringF0_pcAEmF">stringConvertible(_:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>A metadata value which is some <code>CustomStringConvertible</code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">stringConvertible</span><span class="p">(</span><span class="kt">CustomStringConvertible</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L306">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV13MetadataValueO10dictionaryyAESDySSAEGcAEmF"></a>
|
||||
<a name="//apple_ref/swift/Element/dictionary(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV13MetadataValueO10dictionaryyAESDySSAEGcAEmF">dictionary(_:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>A metadata value which is a dictionary from <code>String</code> to <code>Logger.MetadataValue</code>.</p>
|
||||
|
||||
<p>Because <code>MetadataValue</code> implements <code>ExpressibleByDictionaryLiteral</code>, you don’t need to type
|
||||
<code>.dictionary(["foo": .string("bar \(buz)")])</code>, you can just use the more natural <code>["foo": "bar \(buz)"]</code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">dictionary</span><span class="p">(</span><span class="kt"><a href="../../Structs/Logger.html#/s:7Logging6LoggerV8Metadataa">Metadata</a></span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L312">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV13MetadataValueO5arrayyAESayAEGcAEmF"></a>
|
||||
<a name="//apple_ref/swift/Element/array(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV13MetadataValueO5arrayyAESayAEGcAEmF">array(_:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>A metadata value which is an array of <code>Logger.MetadataValue</code>s.</p>
|
||||
|
||||
<p>Because <code>MetadataValue</code> implements <code>ExpressibleByArrayLiteral</code>, you don’t need to type
|
||||
<code>.array([.string("foo"), .string("bar \(buz)")])</code>, you can just use the more natural <code>["foo", "bar \(buz)"]</code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">array</span><span class="p">([</span><span class="kt"><a href="../../Structs/Logger.html#/s:7Logging6LoggerV8Metadataa">Metadata</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger/MetadataValue.html#/s:s30ExpressibleByDictionaryLiteralP5ValueQa">Value</a></span><span class="p">])</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L318">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:SQ2eeoiySbx_xtFZ"></a>
|
||||
<a name="//apple_ref/swift/Method/==(_:_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:SQ2eeoiySbx_xtFZ">==(_:_:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger.html#/s:7Logging6LoggerV8Metadataa">Metadata</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger/MetadataValue.html#/s:s30ExpressibleByDictionaryLiteralP5ValueQa">Value</a></span><span class="p">,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger.html#/s:7Logging6LoggerV8Metadataa">Metadata</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger/MetadataValue.html#/s:s30ExpressibleByDictionaryLiteralP5ValueQa">Value</a></span><span class="p">)</span> <span class="o">-></span> <span class="kt">Bool</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L415-L428">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s26ExpressibleByStringLiteralP0cD4TypeQa"></a>
|
||||
<a name="//apple_ref/swift/Alias/StringLiteralType" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s26ExpressibleByStringLiteralP0cD4TypeQa">StringLiteralType</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">StringLiteralType</span> <span class="o">=</span> <span class="kt">String</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s26ExpressibleByStringLiteralP06stringD0x0cD4TypeQz_tcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(stringLiteral:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s26ExpressibleByStringLiteralP06stringD0x0cD4TypeQz_tcfc">init(stringLiteral:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">stringLiteral</span> <span class="nv">value</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L654-L656">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s23CustomStringConvertibleP11descriptionSSvp"></a>
|
||||
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s23CustomStringConvertibleP11descriptionSSvp">description</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L662-L673">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s30ExpressibleByDictionaryLiteralP3KeyQa"></a>
|
||||
<a name="//apple_ref/swift/Alias/Key" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s30ExpressibleByDictionaryLiteralP3KeyQa">Key</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Key</span> <span class="o">=</span> <span class="kt">String</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s30ExpressibleByDictionaryLiteralP5ValueQa"></a>
|
||||
<a name="//apple_ref/swift/Alias/Value" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s30ExpressibleByDictionaryLiteralP5ValueQa">Value</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Value</span> <span class="o">=</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger.html#/s:7Logging6LoggerV8Metadataa">Metadata</a></span><span class="o">.</span><span class="kt">Value</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s30ExpressibleByDictionaryLiteralP010dictionaryD0x3KeyQz_5ValueQztd_tcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(dictionaryLiteral:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s30ExpressibleByDictionaryLiteralP010dictionaryD0x3KeyQz_5ValueQztd_tcfc">init(dictionaryLiteral:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">dictionaryLiteral</span> <span class="nv">elements</span><span class="p">:</span> <span class="p">(</span><span class="kt">String</span><span class="p">,</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger.html#/s:7Logging6LoggerV8Metadataa">Metadata</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger/MetadataValue.html#/s:s30ExpressibleByDictionaryLiteralP5ValueQa">Value</a></span><span class="p">)</span><span class="o">...</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L686-L688">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s25ExpressibleByArrayLiteralP0cD7ElementQa"></a>
|
||||
<a name="//apple_ref/swift/Alias/ArrayLiteralElement" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s25ExpressibleByArrayLiteralP0cD7ElementQa">ArrayLiteralElement</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">ArrayLiteralElement</span> <span class="o">=</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger.html#/s:7Logging6LoggerV8Metadataa">Metadata</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger/MetadataValue.html#/s:s30ExpressibleByDictionaryLiteralP5ValueQa">Value</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s25ExpressibleByArrayLiteralP05arrayD0x0cD7ElementQzd_tcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(arrayLiteral:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s25ExpressibleByArrayLiteralP05arrayD0x0cD7ElementQzd_tcfc">init(arrayLiteral:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">arrayLiteral</span> <span class="nv">elements</span><span class="p">:</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger.html#/s:7Logging6LoggerV8Metadataa">Metadata</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger/MetadataValue.html#/s:s30ExpressibleByDictionaryLiteralP5ValueQa">Value</a></span><span class="o">...</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L696-L698">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2020 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external">SwiftLog team</a>. All rights reserved. (Last updated: 2020-02-28)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,306 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>MultiplexLogHandler Structure Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../js/jquery.min.js" defer></script>
|
||||
<script src="../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../js/lunr.min.js" defer></script>
|
||||
<script src="../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Struct/MultiplexLogHandler" class="dashAnchor"></a>
|
||||
|
||||
<a title="MultiplexLogHandler Structure Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
Logging 1.2.0 Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="dash-feed://https%3A%2F%2Fapple%2Egithub%2Eio%2Fswift%2Dlog%2Fdocs%2F1%2E2%2E0%2FLogging%2Fdocsets%2FLogging%2Exml">
|
||||
<img class="header-icon" src="../img/dash.png"/>
|
||||
Install in Dash
|
||||
</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">Logging Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
MultiplexLogHandler Structure Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>MultiplexLogHandler</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">MultiplexLogHandler</span> <span class="p">:</span> <span class="kt"><a href="../Protocols/LogHandler.html">LogHandler</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>A pseudo-<code><a href="../Protocols/LogHandler.html">LogHandler</a></code> that can be used to send messages to multiple other <code><a href="../Protocols/LogHandler.html">LogHandler</a></code>s.</p>
|
||||
|
||||
<p>The first <code><a href="../Protocols/LogHandler.html">LogHandler</a></code> passed to the initialisation function of <code>MultiplexLogHandler</code> control the <code>logLevel</code> as
|
||||
well as the <code>metadata</code> for this <code><a href="../Protocols/LogHandler.html">LogHandler</a></code>. Any subsequent <code><a href="../Protocols/LogHandler.html">LogHandler</a></code>s used to initialise a
|
||||
<code>MultiplexLogHandler</code> are merely to emit the log message to another place.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging19MultiplexLogHandlerVyACSayAA0cD0_pGcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging19MultiplexLogHandlerVyACSayAA0cD0_pGcfc">init(_:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Create a <code>MultiplexLogHandler</code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">_</span> <span class="nv">handlers</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Protocols/LogHandler.html">LogHandler</a></span><span class="p">])</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>handlers</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>An array of <code><a href="../Protocols/LogHandler.html">LogHandler</a></code>s, each of which will receive the log messages sent to this <code><a href="../Structs/Logger.html">Logger</a></code>.
|
||||
The array must not be empty.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L474-L477">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp"></a>
|
||||
<a name="//apple_ref/swift/Property/logLevel" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp">logLevel</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">logLevel</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L479-L488">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP3log5level7message8metadata4file8function4lineyAA6LoggerV5LevelO_AL7MessageVSDySSAL13MetadataValueOGSgS2SSutF"></a>
|
||||
<a name="//apple_ref/swift/Method/log(level:message:metadata:file:function:line:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP3log5level7message8metadata4file8function4lineyAA6LoggerV5LevelO_AL7MessageVSDySSAL13MetadataValueOGSgS2SSutF">log(level:message:metadata:file:function:line:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">log</span><span class="p">(</span><span class="nv">level</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span><span class="p">,</span>
|
||||
<span class="nv">message</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Message</span><span class="p">,</span>
|
||||
<span class="nv">metadata</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span><span class="p">?,</span>
|
||||
<span class="nv">file</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">function</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">line</span><span class="p">:</span> <span class="kt">UInt</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L490-L497">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP8metadataSDySSAA6LoggerV13MetadataValueOGvp"></a>
|
||||
<a name="//apple_ref/swift/Property/metadata" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP8metadataSDySSAA6LoggerV13MetadataValueOGvp">metadata</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">metadata</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L499-L506">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP11metadataKeyAA6LoggerV13MetadataValueOSgSS_tcip"></a>
|
||||
<a name="//apple_ref/swift/Method/subscript(metadataKey:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP11metadataKeyAA6LoggerV13MetadataValueOSgSS_tcip">subscript(metadataKey:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">subscript</span><span class="p">(</span><span class="n">metadataKey</span> <span class="nv">metadataKey</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span><span class="o">.</span><span class="kt">Value</span><span class="p">?</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L508-L515">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2020 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external">SwiftLog team</a>. All rights reserved. (Last updated: 2020-02-28)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,313 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>StreamLogHandler Structure Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../js/jquery.min.js" defer></script>
|
||||
<script src="../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../js/lunr.min.js" defer></script>
|
||||
<script src="../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Struct/StreamLogHandler" class="dashAnchor"></a>
|
||||
|
||||
<a title="StreamLogHandler Structure Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
Logging 1.2.0 Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="dash-feed://https%3A%2F%2Fapple%2Egithub%2Eio%2Fswift%2Dlog%2Fdocs%2F1%2E2%2E0%2FLogging%2Fdocsets%2FLogging%2Exml">
|
||||
<img class="header-icon" src="../img/dash.png"/>
|
||||
Install in Dash
|
||||
</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">Logging Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
StreamLogHandler Structure Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>StreamLogHandler</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">StreamLogHandler</span> <span class="p">:</span> <span class="kt"><a href="../Protocols/LogHandler.html">LogHandler</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p><code>StreamLogHandler</code> is a simple implementation of <code><a href="../Protocols/LogHandler.html">LogHandler</a></code> for directing
|
||||
<code><a href="../Structs/Logger.html">Logger</a></code> output to either <code>stderr</code> or <code>stdout</code> via the factory methods.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging16StreamLogHandlerV14standardOutput5labelACSS_tFZ"></a>
|
||||
<a name="//apple_ref/swift/Method/standardOutput(label:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging16StreamLogHandlerV14standardOutput5labelACSS_tFZ">standardOutput(label:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Factory that makes a <code>StreamLogHandler</code> to directs its output to <code>stdout</code></p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="nf">standardOutput</span><span class="p">(</span><span class="nv">label</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt">StreamLogHandler</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L584-L586">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging16StreamLogHandlerV13standardError5labelACSS_tFZ"></a>
|
||||
<a name="//apple_ref/swift/Method/standardError(label:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging16StreamLogHandlerV13standardError5labelACSS_tFZ">standardError(label:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Factory that makes a <code>StreamLogHandler</code> to directs its output to <code>stderr</code></p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="nf">standardError</span><span class="p">(</span><span class="nv">label</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt">StreamLogHandler</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L589-L591">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp"></a>
|
||||
<a name="//apple_ref/swift/Property/logLevel" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp">logLevel</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">logLevel</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L152">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP8metadataSDySSAA6LoggerV13MetadataValueOGvp"></a>
|
||||
<a name="//apple_ref/swift/Property/metadata" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP8metadataSDySSAA6LoggerV13MetadataValueOGvp">metadata</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">metadata</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L599-L603">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP11metadataKeyAA6LoggerV13MetadataValueOSgSS_tcip"></a>
|
||||
<a name="//apple_ref/swift/Method/subscript(metadataKey:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP11metadataKeyAA6LoggerV13MetadataValueOSgSS_tcip">subscript(metadataKey:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">subscript</span><span class="p">(</span><span class="n">metadataKey</span> <span class="nv">metadataKey</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span><span class="o">.</span><span class="kt">Value</span><span class="p">?</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L605-L612">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP3log5level7message8metadata4file8function4lineyAA6LoggerV5LevelO_AL7MessageVSDySSAL13MetadataValueOGSgS2SSutF"></a>
|
||||
<a name="//apple_ref/swift/Method/log(level:message:metadata:file:function:line:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP3log5level7message8metadata4file8function4lineyAA6LoggerV5LevelO_AL7MessageVSDySSAL13MetadataValueOGSgS2SSutF">log(level:message:metadata:file:function:line:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">log</span><span class="p">(</span><span class="nv">level</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span><span class="p">,</span>
|
||||
<span class="nv">message</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Message</span><span class="p">,</span>
|
||||
<span class="nv">metadata</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span><span class="p">?,</span>
|
||||
<span class="nv">file</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">function</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">line</span><span class="p">:</span> <span class="kt">UInt</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.2.0/Sources/Logging/Logging.swift#L620-L630">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2020 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external">SwiftLog team</a>. All rights reserved. (Last updated: 2020-02-28)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,28 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="136" height="20">
|
||||
<linearGradient id="b" x2="0" y2="100%">
|
||||
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
||||
<stop offset="1" stop-opacity=".1"/>
|
||||
</linearGradient>
|
||||
<clipPath id="a">
|
||||
<rect width="136" height="20" rx="3" fill="#fff"/>
|
||||
</clipPath>
|
||||
<g clip-path="url(#a)">
|
||||
<path fill="#555" d="M0 0h93v20H0z"/>
|
||||
<path fill="#4c1" d="M93 0h43v20H93z"/>
|
||||
<path fill="url(#b)" d="M0 0h136v20H0z"/>
|
||||
</g>
|
||||
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110">
|
||||
<text x="475" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="830">
|
||||
documentation
|
||||
</text>
|
||||
<text x="475" y="140" transform="scale(.1)" textLength="830">
|
||||
documentation
|
||||
</text>
|
||||
<text x="1135" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="330">
|
||||
100%
|
||||
</text>
|
||||
<text x="1135" y="140" transform="scale(.1)" textLength="330">
|
||||
100%
|
||||
</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -1,200 +0,0 @@
|
||||
/* Credit to https://gist.github.com/wataru420/2048287 */
|
||||
.highlight {
|
||||
/* Comment */
|
||||
/* Error */
|
||||
/* Keyword */
|
||||
/* Operator */
|
||||
/* Comment.Multiline */
|
||||
/* Comment.Preproc */
|
||||
/* Comment.Single */
|
||||
/* Comment.Special */
|
||||
/* Generic.Deleted */
|
||||
/* Generic.Deleted.Specific */
|
||||
/* Generic.Emph */
|
||||
/* Generic.Error */
|
||||
/* Generic.Heading */
|
||||
/* Generic.Inserted */
|
||||
/* Generic.Inserted.Specific */
|
||||
/* Generic.Output */
|
||||
/* Generic.Prompt */
|
||||
/* Generic.Strong */
|
||||
/* Generic.Subheading */
|
||||
/* Generic.Traceback */
|
||||
/* Keyword.Constant */
|
||||
/* Keyword.Declaration */
|
||||
/* Keyword.Pseudo */
|
||||
/* Keyword.Reserved */
|
||||
/* Keyword.Type */
|
||||
/* Literal.Number */
|
||||
/* Literal.String */
|
||||
/* Name.Attribute */
|
||||
/* Name.Builtin */
|
||||
/* Name.Class */
|
||||
/* Name.Constant */
|
||||
/* Name.Entity */
|
||||
/* Name.Exception */
|
||||
/* Name.Function */
|
||||
/* Name.Namespace */
|
||||
/* Name.Tag */
|
||||
/* Name.Variable */
|
||||
/* Operator.Word */
|
||||
/* Text.Whitespace */
|
||||
/* Literal.Number.Float */
|
||||
/* Literal.Number.Hex */
|
||||
/* Literal.Number.Integer */
|
||||
/* Literal.Number.Oct */
|
||||
/* Literal.String.Backtick */
|
||||
/* Literal.String.Char */
|
||||
/* Literal.String.Doc */
|
||||
/* Literal.String.Double */
|
||||
/* Literal.String.Escape */
|
||||
/* Literal.String.Heredoc */
|
||||
/* Literal.String.Interpol */
|
||||
/* Literal.String.Other */
|
||||
/* Literal.String.Regex */
|
||||
/* Literal.String.Single */
|
||||
/* Literal.String.Symbol */
|
||||
/* Name.Builtin.Pseudo */
|
||||
/* Name.Variable.Class */
|
||||
/* Name.Variable.Global */
|
||||
/* Name.Variable.Instance */
|
||||
/* Literal.Number.Integer.Long */ }
|
||||
.highlight .c {
|
||||
color: #999988;
|
||||
font-style: italic; }
|
||||
.highlight .err {
|
||||
color: #a61717;
|
||||
background-color: #e3d2d2; }
|
||||
.highlight .k {
|
||||
color: #000000;
|
||||
font-weight: bold; }
|
||||
.highlight .o {
|
||||
color: #000000;
|
||||
font-weight: bold; }
|
||||
.highlight .cm {
|
||||
color: #999988;
|
||||
font-style: italic; }
|
||||
.highlight .cp {
|
||||
color: #999999;
|
||||
font-weight: bold; }
|
||||
.highlight .c1 {
|
||||
color: #999988;
|
||||
font-style: italic; }
|
||||
.highlight .cs {
|
||||
color: #999999;
|
||||
font-weight: bold;
|
||||
font-style: italic; }
|
||||
.highlight .gd {
|
||||
color: #000000;
|
||||
background-color: #ffdddd; }
|
||||
.highlight .gd .x {
|
||||
color: #000000;
|
||||
background-color: #ffaaaa; }
|
||||
.highlight .ge {
|
||||
color: #000000;
|
||||
font-style: italic; }
|
||||
.highlight .gr {
|
||||
color: #aa0000; }
|
||||
.highlight .gh {
|
||||
color: #999999; }
|
||||
.highlight .gi {
|
||||
color: #000000;
|
||||
background-color: #ddffdd; }
|
||||
.highlight .gi .x {
|
||||
color: #000000;
|
||||
background-color: #aaffaa; }
|
||||
.highlight .go {
|
||||
color: #888888; }
|
||||
.highlight .gp {
|
||||
color: #555555; }
|
||||
.highlight .gs {
|
||||
font-weight: bold; }
|
||||
.highlight .gu {
|
||||
color: #aaaaaa; }
|
||||
.highlight .gt {
|
||||
color: #aa0000; }
|
||||
.highlight .kc {
|
||||
color: #000000;
|
||||
font-weight: bold; }
|
||||
.highlight .kd {
|
||||
color: #000000;
|
||||
font-weight: bold; }
|
||||
.highlight .kp {
|
||||
color: #000000;
|
||||
font-weight: bold; }
|
||||
.highlight .kr {
|
||||
color: #000000;
|
||||
font-weight: bold; }
|
||||
.highlight .kt {
|
||||
color: #445588; }
|
||||
.highlight .m {
|
||||
color: #009999; }
|
||||
.highlight .s {
|
||||
color: #d14; }
|
||||
.highlight .na {
|
||||
color: #008080; }
|
||||
.highlight .nb {
|
||||
color: #0086B3; }
|
||||
.highlight .nc {
|
||||
color: #445588;
|
||||
font-weight: bold; }
|
||||
.highlight .no {
|
||||
color: #008080; }
|
||||
.highlight .ni {
|
||||
color: #800080; }
|
||||
.highlight .ne {
|
||||
color: #990000;
|
||||
font-weight: bold; }
|
||||
.highlight .nf {
|
||||
color: #990000; }
|
||||
.highlight .nn {
|
||||
color: #555555; }
|
||||
.highlight .nt {
|
||||
color: #000080; }
|
||||
.highlight .nv {
|
||||
color: #008080; }
|
||||
.highlight .ow {
|
||||
color: #000000;
|
||||
font-weight: bold; }
|
||||
.highlight .w {
|
||||
color: #bbbbbb; }
|
||||
.highlight .mf {
|
||||
color: #009999; }
|
||||
.highlight .mh {
|
||||
color: #009999; }
|
||||
.highlight .mi {
|
||||
color: #009999; }
|
||||
.highlight .mo {
|
||||
color: #009999; }
|
||||
.highlight .sb {
|
||||
color: #d14; }
|
||||
.highlight .sc {
|
||||
color: #d14; }
|
||||
.highlight .sd {
|
||||
color: #d14; }
|
||||
.highlight .s2 {
|
||||
color: #d14; }
|
||||
.highlight .se {
|
||||
color: #d14; }
|
||||
.highlight .sh {
|
||||
color: #d14; }
|
||||
.highlight .si {
|
||||
color: #d14; }
|
||||
.highlight .sx {
|
||||
color: #d14; }
|
||||
.highlight .sr {
|
||||
color: #009926; }
|
||||
.highlight .s1 {
|
||||
color: #d14; }
|
||||
.highlight .ss {
|
||||
color: #990073; }
|
||||
.highlight .bp {
|
||||
color: #999999; }
|
||||
.highlight .vc {
|
||||
color: #008080; }
|
||||
.highlight .vg {
|
||||
color: #008080; }
|
||||
.highlight .vi {
|
||||
color: #008080; }
|
||||
.highlight .il {
|
||||
color: #009999; }
|
||||
@@ -1,396 +0,0 @@
|
||||
*, *:before, *:after {
|
||||
box-sizing: inherit; }
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
background: #fff;
|
||||
color: #333;
|
||||
font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
letter-spacing: .2px;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
box-sizing: border-box; }
|
||||
|
||||
h1 {
|
||||
font-size: 2rem;
|
||||
font-weight: 700;
|
||||
margin: 1.275em 0 0.6em; }
|
||||
|
||||
h2 {
|
||||
font-size: 1.75rem;
|
||||
font-weight: 700;
|
||||
margin: 1.275em 0 0.3em; }
|
||||
|
||||
h3 {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
margin: 1em 0 0.3em; }
|
||||
|
||||
h4 {
|
||||
font-size: 1.25rem;
|
||||
font-weight: 700;
|
||||
margin: 1.275em 0 0.85em; }
|
||||
|
||||
h5 {
|
||||
font-size: 1rem;
|
||||
font-weight: 700;
|
||||
margin: 1.275em 0 0.85em; }
|
||||
|
||||
h6 {
|
||||
font-size: 1rem;
|
||||
font-weight: 700;
|
||||
margin: 1.275em 0 0.85em;
|
||||
color: #777; }
|
||||
|
||||
p {
|
||||
margin: 0 0 1em; }
|
||||
|
||||
ul, ol {
|
||||
padding: 0 0 0 2em;
|
||||
margin: 0 0 0.85em; }
|
||||
|
||||
blockquote {
|
||||
margin: 0 0 0.85em;
|
||||
padding: 0 15px;
|
||||
color: #858585;
|
||||
border-left: 4px solid #e5e5e5; }
|
||||
|
||||
img {
|
||||
max-width: 100%; }
|
||||
|
||||
a {
|
||||
color: #4183c4;
|
||||
text-decoration: none; }
|
||||
a:hover, a:focus {
|
||||
outline: 0;
|
||||
text-decoration: underline; }
|
||||
a.discouraged {
|
||||
text-decoration: line-through; }
|
||||
a.discouraged:hover, a.discouraged:focus {
|
||||
text-decoration: underline line-through; }
|
||||
|
||||
table {
|
||||
background: #fff;
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
overflow: auto;
|
||||
margin: 0 0 0.85em; }
|
||||
|
||||
tr:nth-child(2n) {
|
||||
background-color: #fbfbfb; }
|
||||
|
||||
th, td {
|
||||
padding: 6px 13px;
|
||||
border: 1px solid #ddd; }
|
||||
|
||||
pre {
|
||||
margin: 0 0 1.275em;
|
||||
padding: .85em 1em;
|
||||
overflow: auto;
|
||||
background: #f7f7f7;
|
||||
font-size: .85em;
|
||||
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; }
|
||||
|
||||
code {
|
||||
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; }
|
||||
|
||||
.item-container p > code, .item-container li > code, .top-matter p > code, .top-matter li > code {
|
||||
background: #f7f7f7;
|
||||
padding: .2em; }
|
||||
.item-container p > code:before, .item-container p > code:after, .item-container li > code:before, .item-container li > code:after, .top-matter p > code:before, .top-matter p > code:after, .top-matter li > code:before, .top-matter li > code:after {
|
||||
letter-spacing: -.2em;
|
||||
content: "\00a0"; }
|
||||
|
||||
pre code {
|
||||
padding: 0;
|
||||
white-space: pre; }
|
||||
|
||||
.content-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column; }
|
||||
@media (min-width: 768px) {
|
||||
.content-wrapper {
|
||||
flex-direction: row; } }
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
padding: 8px;
|
||||
font-size: 0.875em;
|
||||
background: #444;
|
||||
color: #999; }
|
||||
|
||||
.header-col {
|
||||
margin: 0;
|
||||
padding: 0 8px; }
|
||||
|
||||
.header-col--primary {
|
||||
flex: 1; }
|
||||
|
||||
.header-link {
|
||||
color: #fff; }
|
||||
|
||||
.header-icon {
|
||||
padding-right: 6px;
|
||||
vertical-align: -4px;
|
||||
height: 16px; }
|
||||
|
||||
.breadcrumbs {
|
||||
font-size: 0.875em;
|
||||
padding: 8px 16px;
|
||||
margin: 0;
|
||||
background: #fbfbfb;
|
||||
border-bottom: 1px solid #ddd; }
|
||||
|
||||
.carat {
|
||||
height: 10px;
|
||||
margin: 0 5px; }
|
||||
|
||||
.navigation {
|
||||
order: 2; }
|
||||
@media (min-width: 768px) {
|
||||
.navigation {
|
||||
order: 1;
|
||||
width: 25%;
|
||||
max-width: 300px;
|
||||
padding-bottom: 64px;
|
||||
overflow: hidden;
|
||||
word-wrap: normal;
|
||||
background: #fbfbfb;
|
||||
border-right: 1px solid #ddd; } }
|
||||
|
||||
.nav-groups {
|
||||
list-style-type: none;
|
||||
padding-left: 0; }
|
||||
|
||||
.nav-group-name {
|
||||
border-bottom: 1px solid #ddd;
|
||||
padding: 8px 0 8px 16px; }
|
||||
|
||||
.nav-group-name-link {
|
||||
color: #333; }
|
||||
|
||||
.nav-group-tasks {
|
||||
margin: 8px 0;
|
||||
padding: 0 0 0 8px; }
|
||||
|
||||
.nav-group-task {
|
||||
font-size: 1em;
|
||||
list-style-type: none;
|
||||
white-space: nowrap; }
|
||||
|
||||
.nav-group-task-link {
|
||||
color: #808080; }
|
||||
|
||||
.main-content {
|
||||
order: 1; }
|
||||
@media (min-width: 768px) {
|
||||
.main-content {
|
||||
order: 2;
|
||||
flex: 1;
|
||||
padding-bottom: 60px; } }
|
||||
|
||||
.section {
|
||||
padding: 0 32px;
|
||||
border-bottom: 1px solid #ddd; }
|
||||
|
||||
.section-content {
|
||||
max-width: 834px;
|
||||
margin: 0 auto;
|
||||
padding: 16px 0; }
|
||||
|
||||
.section-name {
|
||||
color: #666;
|
||||
display: block; }
|
||||
.section-name p {
|
||||
margin-bottom: inherit; }
|
||||
|
||||
.declaration .highlight {
|
||||
overflow-x: initial;
|
||||
padding: 8px 0;
|
||||
margin: 0;
|
||||
background-color: transparent;
|
||||
border: none; }
|
||||
|
||||
.task-group-section {
|
||||
border-top: 1px solid #ddd; }
|
||||
|
||||
.task-group {
|
||||
padding-top: 0px; }
|
||||
|
||||
.task-name-container a[name]:before {
|
||||
content: "";
|
||||
display: block; }
|
||||
|
||||
.section-name-container {
|
||||
position: relative; }
|
||||
.section-name-container .section-name-link {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
margin-bottom: 0; }
|
||||
.section-name-container .section-name {
|
||||
position: relative;
|
||||
pointer-events: none;
|
||||
z-index: 1; }
|
||||
.section-name-container .section-name a {
|
||||
pointer-events: auto; }
|
||||
|
||||
.item-container {
|
||||
padding: 0; }
|
||||
|
||||
.item {
|
||||
padding-top: 8px;
|
||||
width: 100%;
|
||||
list-style-type: none; }
|
||||
.item a[name]:before {
|
||||
content: "";
|
||||
display: block; }
|
||||
.item .token, .item .direct-link {
|
||||
padding-left: 3px;
|
||||
margin-left: 0px;
|
||||
font-size: 1rem; }
|
||||
.item .declaration-note {
|
||||
font-size: .85em;
|
||||
color: #808080;
|
||||
font-style: italic; }
|
||||
|
||||
.pointer-container {
|
||||
border-bottom: 1px solid #ddd;
|
||||
left: -23px;
|
||||
padding-bottom: 13px;
|
||||
position: relative;
|
||||
width: 110%; }
|
||||
|
||||
.pointer {
|
||||
left: 21px;
|
||||
top: 7px;
|
||||
display: block;
|
||||
position: absolute;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-left: 1px solid #ddd;
|
||||
border-top: 1px solid #ddd;
|
||||
background: #fff;
|
||||
transform: rotate(45deg); }
|
||||
|
||||
.height-container {
|
||||
display: none;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
overflow: hidden; }
|
||||
.height-container .section {
|
||||
background: #fff;
|
||||
border: 1px solid #ddd;
|
||||
border-top-width: 0;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 5px;
|
||||
padding: 8px 16px; }
|
||||
|
||||
.aside, .language {
|
||||
padding: 6px 12px;
|
||||
margin: 12px 0;
|
||||
border-left: 5px solid #dddddd;
|
||||
overflow-y: hidden; }
|
||||
.aside .aside-title, .language .aside-title {
|
||||
font-size: 9px;
|
||||
letter-spacing: 2px;
|
||||
text-transform: uppercase;
|
||||
padding-bottom: 0;
|
||||
margin: 0;
|
||||
color: #aaa;
|
||||
-webkit-user-select: none; }
|
||||
.aside p:last-child, .language p:last-child {
|
||||
margin-bottom: 0; }
|
||||
|
||||
.language {
|
||||
border-left: 5px solid #cde9f4; }
|
||||
.language .aside-title {
|
||||
color: #4183c4; }
|
||||
|
||||
.aside-warning, .aside-deprecated, .aside-unavailable {
|
||||
border-left: 5px solid #ff6666; }
|
||||
.aside-warning .aside-title, .aside-deprecated .aside-title, .aside-unavailable .aside-title {
|
||||
color: #ff0000; }
|
||||
|
||||
.graybox {
|
||||
border-collapse: collapse;
|
||||
width: 100%; }
|
||||
.graybox p {
|
||||
margin: 0;
|
||||
word-break: break-word;
|
||||
min-width: 50px; }
|
||||
.graybox td {
|
||||
border: 1px solid #ddd;
|
||||
padding: 5px 25px 5px 10px;
|
||||
vertical-align: middle; }
|
||||
.graybox tr td:first-of-type {
|
||||
text-align: right;
|
||||
padding: 7px;
|
||||
vertical-align: top;
|
||||
word-break: normal;
|
||||
width: 40px; }
|
||||
|
||||
.slightly-smaller {
|
||||
font-size: 0.9em; }
|
||||
|
||||
.footer {
|
||||
padding: 8px 16px;
|
||||
background: #444;
|
||||
color: #ddd;
|
||||
font-size: 0.8em; }
|
||||
.footer p {
|
||||
margin: 8px 0; }
|
||||
.footer a {
|
||||
color: #fff; }
|
||||
|
||||
html.dash .header, html.dash .breadcrumbs, html.dash .navigation {
|
||||
display: none; }
|
||||
|
||||
html.dash .height-container {
|
||||
display: block; }
|
||||
|
||||
form[role=search] input {
|
||||
font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
line-height: 24px;
|
||||
padding: 0 10px;
|
||||
margin: 0;
|
||||
border: none;
|
||||
border-radius: 1em; }
|
||||
.loading form[role=search] input {
|
||||
background: white url(../img/spinner.gif) center right 4px no-repeat; }
|
||||
|
||||
form[role=search] .tt-menu {
|
||||
margin: 0;
|
||||
min-width: 300px;
|
||||
background: #fbfbfb;
|
||||
color: #333;
|
||||
border: 1px solid #ddd; }
|
||||
|
||||
form[role=search] .tt-highlight {
|
||||
font-weight: bold; }
|
||||
|
||||
form[role=search] .tt-suggestion {
|
||||
font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
padding: 0 8px; }
|
||||
form[role=search] .tt-suggestion span {
|
||||
display: table-cell;
|
||||
white-space: nowrap; }
|
||||
form[role=search] .tt-suggestion .doc-parent-name {
|
||||
width: 100%;
|
||||
text-align: right;
|
||||
font-weight: normal;
|
||||
font-size: 0.9em;
|
||||
padding-left: 16px; }
|
||||
|
||||
form[role=search] .tt-suggestion:hover,
|
||||
form[role=search] .tt-suggestion.tt-cursor {
|
||||
cursor: pointer;
|
||||
background-color: #4183c4;
|
||||
color: #fff; }
|
||||
|
||||
form[role=search] .tt-suggestion:hover .doc-parent-name,
|
||||
form[role=search] .tt-suggestion.tt-cursor .doc-parent-name {
|
||||
color: #fff; }
|
||||
|
Before Width: | Height: | Size: 274 B |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
@@ -1,124 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Logging Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="js/jquery.min.js" defer></script>
|
||||
<script src="js/jazzy.js" defer></script>
|
||||
|
||||
<script src="js/lunr.min.js" defer></script>
|
||||
<script src="js/typeahead.jquery.js" defer></script>
|
||||
<script src="js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<a title="Logging Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="index.html">
|
||||
Logging 1.2.0 Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="dash-feed://https%3A%2F%2Fapple%2Egithub%2Eio%2Fswift%2Dlog%2Fdocs%2F1%2E2%2E0%2FLogging%2Fdocsets%2FLogging%2Exml">
|
||||
<img class="header-icon" src="img/dash.png"/>
|
||||
Install in Dash
|
||||
</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="index.html">Logging Reference</a>
|
||||
<img class="carat" src="img/carat.png" />
|
||||
Logging Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
|
||||
<h1 id='swiftlog-docs' class='heading'>SwiftLog Docs</h1>
|
||||
|
||||
<p>SwiftLog is a Swift logging API package.</p>
|
||||
|
||||
<p>To get started with SwiftLog, <a href="../Logging/index.html"><code>import Logging</code></a>. The
|
||||
most important type is <a href="https://apple.github.io/swift-log/docs/current/Logging/Structs/Logger.html"><code><a href="Structs/Logger.html">Logger</a></code></a>
|
||||
which you can use to emit log messages.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2020 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external">SwiftLog team</a>. All rights reserved. (Last updated: 2020-02-28)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,59 +0,0 @@
|
||||
window.jazzy = {'docset': false}
|
||||
if (typeof window.dash != 'undefined') {
|
||||
document.documentElement.className += ' dash'
|
||||
window.jazzy.docset = true
|
||||
}
|
||||
if (navigator.userAgent.match(/xcode/i)) {
|
||||
document.documentElement.className += ' xcode'
|
||||
window.jazzy.docset = true
|
||||
}
|
||||
|
||||
function toggleItem($link, $content) {
|
||||
var animationDuration = 300;
|
||||
$link.toggleClass('token-open');
|
||||
$content.slideToggle(animationDuration);
|
||||
}
|
||||
|
||||
function itemLinkToContent($link) {
|
||||
return $link.parent().parent().next();
|
||||
}
|
||||
|
||||
// On doc load + hash-change, open any targetted item
|
||||
function openCurrentItemIfClosed() {
|
||||
if (window.jazzy.docset) {
|
||||
return;
|
||||
}
|
||||
var $link = $(`.token[href="${location.hash}"]`);
|
||||
$content = itemLinkToContent($link);
|
||||
if ($content.is(':hidden')) {
|
||||
toggleItem($link, $content);
|
||||
}
|
||||
}
|
||||
|
||||
$(openCurrentItemIfClosed);
|
||||
$(window).on('hashchange', openCurrentItemIfClosed);
|
||||
|
||||
// On item link ('token') click, toggle its discussion
|
||||
$('.token').on('click', function(event) {
|
||||
if (window.jazzy.docset) {
|
||||
return;
|
||||
}
|
||||
var $link = $(this);
|
||||
toggleItem($link, itemLinkToContent($link));
|
||||
|
||||
// Keeps the document from jumping to the hash.
|
||||
var href = $link.attr('href');
|
||||
if (history.pushState) {
|
||||
history.pushState({}, '', href);
|
||||
} else {
|
||||
location.hash = href;
|
||||
}
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
// Clicks on links to the current, closed, item need to open the item
|
||||
$("a:not('.token')").on('click', function() {
|
||||
if (location == this.href) {
|
||||
openCurrentItemIfClosed();
|
||||
}
|
||||
});
|
||||
@@ -1,70 +0,0 @@
|
||||
$(function(){
|
||||
var $typeahead = $('[data-typeahead]');
|
||||
var $form = $typeahead.parents('form');
|
||||
var searchURL = $form.attr('action');
|
||||
|
||||
function displayTemplate(result) {
|
||||
return result.name;
|
||||
}
|
||||
|
||||
function suggestionTemplate(result) {
|
||||
var t = '<div class="list-group-item clearfix">';
|
||||
t += '<span class="doc-name">' + result.name + '</span>';
|
||||
if (result.parent_name) {
|
||||
t += '<span class="doc-parent-name label">' + result.parent_name + '</span>';
|
||||
}
|
||||
t += '</div>';
|
||||
return t;
|
||||
}
|
||||
|
||||
$typeahead.one('focus', function() {
|
||||
$form.addClass('loading');
|
||||
|
||||
$.getJSON(searchURL).then(function(searchData) {
|
||||
const searchIndex = lunr(function() {
|
||||
this.ref('url');
|
||||
this.field('name');
|
||||
this.field('abstract');
|
||||
for (const [url, doc] of Object.entries(searchData)) {
|
||||
this.add({url: url, name: doc.name, abstract: doc.abstract});
|
||||
}
|
||||
});
|
||||
|
||||
$typeahead.typeahead(
|
||||
{
|
||||
highlight: true,
|
||||
minLength: 3,
|
||||
autoselect: true
|
||||
},
|
||||
{
|
||||
limit: 10,
|
||||
display: displayTemplate,
|
||||
templates: { suggestion: suggestionTemplate },
|
||||
source: function(query, sync) {
|
||||
const lcSearch = query.toLowerCase();
|
||||
const results = searchIndex.query(function(q) {
|
||||
q.term(lcSearch, { boost: 100 });
|
||||
q.term(lcSearch, {
|
||||
boost: 10,
|
||||
wildcard: lunr.Query.wildcard.TRAILING
|
||||
});
|
||||
}).map(function(result) {
|
||||
var doc = searchData[result.ref];
|
||||
doc.url = result.ref;
|
||||
return doc;
|
||||
});
|
||||
sync(results);
|
||||
}
|
||||
}
|
||||
);
|
||||
$form.removeClass('loading');
|
||||
$typeahead.trigger('focus');
|
||||
});
|
||||
});
|
||||
|
||||
var baseURL = searchURL.slice(0, -"search.json".length);
|
||||
|
||||
$typeahead.on('typeahead:select', function(e, result) {
|
||||
window.location = baseURL + result.url;
|
||||
});
|
||||
});
|
||||
@@ -1,2 +0,0 @@
|
||||
/*! jQuery v3.4.1 | (c) JS Foundation and other contributors | jquery.org/license */
|
||||
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],E=C.document,r=Object.getPrototypeOf,s=t.slice,g=t.concat,u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.4.1",k=function(e,t){return new k.fn.init(e,t)},p=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function d(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0<t&&t-1 in e)}k.fn=k.prototype={jquery:f,constructor:k,length:0,toArray:function(){return s.call(this)},get:function(e){return null==e?s.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=k.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return k.each(this,e)},map:function(n){return this.pushStack(k.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(0<=n&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:u,sort:t.sort,splice:t.splice},k.extend=k.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||m(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],"__proto__"!==t&&a!==r&&(l&&r&&(k.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||k.isPlainObject(n)?n:{},i=!1,a[t]=k.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},k.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==o.call(e))&&(!(t=r(e))||"function"==typeof(n=v.call(t,"constructor")&&t.constructor)&&a.call(n)===l)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t){b(e,{nonce:t&&t.nonce})},each:function(e,t){var n,r=0;if(d(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":(e+"").replace(p,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(d(Object(e))?k.merge(n,"string"==typeof e?[e]:e):u.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:i.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,a=[];if(d(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&a.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&a.push(i);return g.apply([],a)},guid:1,support:y}),"function"==typeof Symbol&&(k.fn[Symbol.iterator]=t[Symbol.iterator]),k.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){n["[object "+t+"]"]=t.toLowerCase()});var h=function(n){var e,d,b,o,i,h,f,g,w,u,l,T,C,a,E,v,s,c,y,k="sizzle"+1*new Date,m=n.document,S=0,r=0,p=ue(),x=ue(),N=ue(),A=ue(),D=function(e,t){return e===t&&(l=!0),0},j={}.hasOwnProperty,t=[],q=t.pop,L=t.push,H=t.push,O=t.slice,P=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},R="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",I="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",W="\\["+M+"*("+I+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+I+"))|)"+M+"*\\]",$=":("+I+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+W+")*)|.*)\\)|)",F=new RegExp(M+"+","g"),B=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),_=new RegExp("^"+M+"*,"+M+"*"),z=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp($),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+$),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+Line truncated
|
||||
@@ -1 +0,0 @@
|
||||
!function(){var t,l,c,e,r,h,d,f,p,y,m,g,x,v,w,Q,k,S,E,L,b,P,T,O,I,i,n,s,z=function(e){var t=new z.Builder;return t.pipeline.add(z.trimmer,z.stopWordFilter,z.stemmer),t.searchPipeline.add(z.stemmer),e.call(t,t),t.build()};z.version="2.3.5",z.utils={},z.utils.warn=(t=this,function(e){t.console&&console.warn&&console.warn(e)}),z.utils.asString=function(e){return null==e?"":e.toString()},z.utils.clone=function(e){if(null==e)return e;for(var t=Object.create(null),r=Object.keys(e),i=0;i<r.length;i++){var n=r[i],s=e[n];if(Array.isArray(s))t[n]=s.slice();else{if("string"!=typeof s&&"number"!=typeof s&&"boolean"!=typeof s)throw new TypeError("clone is not deep and does not support nested objects");t[n]=s}}return t},z.FieldRef=function(e,t,r){this.docRef=e,this.fieldName=t,this._stringValue=r},z.FieldRef.joiner="/",z.FieldRef.fromString=function(e){var t=e.indexOf(z.FieldRef.joiner);if(-1===t)throw"malformed field ref string";var r=e.slice(0,t),i=e.slice(t+1);return new z.FieldRef(i,r,e)},z.FieldRef.prototype.toString=function(){return null==this._stringValue&&(this._stringValue=this.fieldName+z.FieldRef.joiner+this.docRef),this._stringValue},z.Set=function(e){if(this.elements=Object.create(null),e){this.length=e.length;for(var t=0;t<this.length;t++)this.elements[e[t]]=!0}else this.length=0},z.Set.complete={intersect:function(e){return e},union:function(e){return e},contains:function(){return!0}},z.Set.empty={intersect:function(){return this},union:function(e){return e},contains:function(){return!1}},z.Set.prototype.contains=function(e){return!!this.elements[e]},z.Set.prototype.intersect=function(e){var t,r,i,n=[];if(e===z.Set.complete)return this;if(e===z.Set.empty)return e;r=this.length<e.length?(t=this,e):(t=e,this),i=Object.keys(t.elements);for(var s=0;s<i.length;s++){var o=i[s];o in r.elements&&n.push(o)}return new z.Set(n)},z.Set.prototype.union=function(e){return e===z.Set.complete?z.Set.complete:e===z.Set.empty?this:new z.Set(Object.keys(this.elements).concat(Object.keys(e.elements)))},z.idf=function(e,t){var r=0;for(var i in e)"_index"!=i&&(r+=Object.keys(e[i]).length);var n=(t-r+.5)/(r+.5);return Math.log(1+Math.abs(n))},z.Token=function(e,t){this.str=e||"",this.metadata=t||{}},z.Token.prototype.toString=function(){return this.str},z.Token.prototype.update=function(e){return this.str=e(this.str,this.metadata),this},z.Token.prototype.clone=function(e){return e=e||function(e){return e},new z.Token(e(this.str,this.metadata),this.metadata)},z.tokenizer=function(e,t){if(null==e||null==e)return[];if(Array.isArray(e))return e.map(function(e){return new z.Token(z.utils.asString(e).toLowerCase(),z.utils.clone(t))});for(var r=e.toString().trim().toLowerCase(),i=r.length,n=[],s=0,o=0;s<=i;s++){var a=s-o;if(r.charAt(s).match(z.tokenizer.separator)||s==i){if(0<a){var u=z.utils.clone(t)||{};u.position=[o,a],u.index=n.length,n.push(new z.Token(r.slice(o,s),u))}o=s+1}}return n},z.tokenizer.separator=/[\s\-]+/,z.Pipeline=function(){this._stack=[]},z.Pipeline.registeredFunctions=Object.create(null),z.Pipeline.registerFunction=function(e,t){t in this.registeredFunctions&&z.utils.warn("Overwriting existing registered function: "+t),e.label=t,z.Pipeline.registeredFunctions[e.label]=e},z.Pipeline.warnIfFunctionNotRegistered=function(e){e.label&&e.label in this.registeredFunctions||z.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},z.Pipeline.load=function(e){var r=new z.Pipeline;return e.forEach(function(e){var t=z.Pipeline.registeredFunctions[e];if(!t)throw new Error("Cannot load unregistered function: "+e);r.add(t)}),r},z.Pipeline.prototype.add=function(){Array.prototype.slice.call(arguments).forEach(function(e){z.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)},this)},z.Pipeline.prototype.after=function(e,t){z.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");r+=1,this._stack.splice(r,0,t)},z.Pipeline.prototype.before=function(e,t){z.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");this._stack.splice(r,0,t)},z.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);-1!=t&&this._stack.splice(t,1)},z.Pipeline.prototype.run=function(e){for(var t=this._stack.length,r=0;r<t;r++){for(var i=this._stack[r],n=[],s=0;s<e.length;s++){var o=i(e[s],s,e);if(void 0!==o&&""!==o)if(Array.isArray(o))for(var a=0;a<o.length;a++)n.push(o[a]);else n.push(o)}e=n}return e},z.Pipeline.prototype.runString=function(e,t){var r=new z.Token(e,t);return this.run([r]).map(function(e){return e.toString()})},z.Pipeline.prototype.reset=function(){this._stack=[]},z.Pipeline.prototype.toJSON=function(){return this._stack.map(function(e){return z.Pipeline.warnIfFunctionNotRegistered(e),e.label})},z.Vector=function(e){this._magnitude=0,this.elements=e||[]},z.Vector.prototype.positionForIndex=function(e){if(0==this.elements.length)return 0;Line truncated
|
||||
@@ -1 +0,0 @@
|
||||
{"Structs/StreamLogHandler.html#/s:7Logging16StreamLogHandlerV14standardOutput5labelACSS_tFZ":{"name":"standardOutput(label:)","abstract":"<p>Factory that makes a <code>StreamLogHandler</code> to directs its output to <code>stdout</code></p>","parent_name":"StreamLogHandler"},"Structs/StreamLogHandler.html#/s:7Logging16StreamLogHandlerV13standardError5labelACSS_tFZ":{"name":"standardError(label:)","abstract":"<p>Factory that makes a <code>StreamLogHandler</code> to directs its output to <code>stderr</code></p>","parent_name":"StreamLogHandler"},"Structs/StreamLogHandler.html#/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp":{"name":"logLevel","parent_name":"StreamLogHandler"},"Structs/StreamLogHandler.html#/s:7Logging10LogHandlerP8metadataSDySSAA6LoggerV13MetadataValueOGvp":{"name":"metadata","parent_name":"StreamLogHandler"},"Structs/StreamLogHandler.html#/s:7Logging10LogHandlerP11metadataKeyAA6LoggerV13MetadataValueOSgSS_tcip":{"name":"subscript(metadataKey:)","parent_name":"StreamLogHandler"},"Structs/StreamLogHandler.html#/s:7Logging10LogHandlerP3log5level7message8metadata4file8function4lineyAA6LoggerV5LevelO_AL7MessageVSDySSAL13MetadataValueOGSgS2SSutF":{"name":"log(level:message:metadata:file:function:line:)","parent_name":"StreamLogHandler"},"Structs/MultiplexLogHandler.html#/s:7Logging19MultiplexLogHandlerVyACSayAA0cD0_pGcfc":{"name":"init(_:)","abstract":"<p>Create a <code>MultiplexLogHandler</code>.</p>","parent_name":"MultiplexLogHandler"},"Structs/MultiplexLogHandler.html#/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp":{"name":"logLevel","parent_name":"MultiplexLogHandler"},"Structs/MultiplexLogHandler.html#/s:7Logging10LogHandlerP3log5level7message8metadata4file8function4lineyAA6LoggerV5LevelO_AL7MessageVSDySSAL13MetadataValueOGSgS2SSutF":{"name":"log(level:message:metadata:file:function:line:)","parent_name":"MultiplexLogHandler"},"Structs/MultiplexLogHandler.html#/s:7Logging10LogHandlerP8metadataSDySSAA6LoggerV13MetadataValueOGvp":{"name":"metadata","parent_name":"MultiplexLogHandler"},"Structs/MultiplexLogHandler.html#/s:7Logging10LogHandlerP11metadataKeyAA6LoggerV13MetadataValueOSgSS_tcip":{"name":"subscript(metadataKey:)","parent_name":"MultiplexLogHandler"},"Structs/Logger/Message.html#/s:s26ExpressibleByStringLiteralP0cD4TypeQa":{"name":"StringLiteralType","parent_name":"Message"},"Structs/Logger/Message.html#/s:s26ExpressibleByStringLiteralP06stringD0x0cD4TypeQz_tcfc":{"name":"init(stringLiteral:)","parent_name":"Message"},"Structs/Logger/Message.html#/s:s23CustomStringConvertibleP11descriptionSSvp":{"name":"description","parent_name":"Message"},"Structs/Logger/Level.html#/s:7Logging6LoggerV5LevelO5traceyA2EmF":{"name":"trace","abstract":"<p>Appropriate for messages that contain information only when debugging a program.</p>","parent_name":"Level"},"Structs/Logger/Level.html#/s:7Logging6LoggerV5LevelO5debugyA2EmF":{"name":"debug","abstract":"<p>Appropriate for messages that contain information normally of use only when","parent_name":"Level"},"Structs/Logger/Level.html#/s:7Logging6LoggerV5LevelO4infoyA2EmF":{"name":"info","abstract":"<p>Appropriate for informational messages.</p>","parent_name":"Level"},"Structs/Logger/Level.html#/s:7Logging6LoggerV5LevelO6noticeyA2EmF":{"name":"notice","abstract":"<p>Appropriate for conditions that are not error conditions, but that may require","parent_name":"Level"},"Structs/Logger/Level.html#/s:7Logging6LoggerV5LevelO7warningyA2EmF":{"name":"warning","abstract":"<p>Appropriate for messages that are not error conditions, but more severe than","parent_name":"Level"},"Structs/Logger/Level.html#/s:7Logging6LoggerV5LevelO5erroryA2EmF":{"name":"error","abstract":"<p>Appropriate for error conditions.</p>","parent_name":"Level"},"Structs/Logger/Level.html#/s:7Logging6LoggerV5LevelO8criticalyA2EmF":{"name":"critical","abstract":"<p>Appropriate for critical error conditions that usually require immediate","parent_name":"Level"},"Structs/Logger/Level.html#/s:SL1loiySbx_xtFZ":{"name":"<(_:_:)","parent_name":"Level"},"Structs/Logger/MetadataValue.html#/s:7Logging6LoggerV13MetadataValueO6stringyAESScAEmF":{"name":"string(_:)","abstract":"<p>A metadata value which is a <code>String</code>.</p>","parent_name":"MetadataValue"},"Structs/Logger/MetadataValue.html#/s:7Logging6LoggerV13MetadataValueO17stringConvertibleyAEs012CustomStringF0_pcAEmF":{"name":"stringConvertible(_:)","abstract":"<p>A metadata value which is some <code>CustomStringConvertible</code>.</p>","parent_name":"MetadataValue"},"Structs/Logger/MetadataValue.html#/s:7Logging6LoggerV13MetadataValueO10dictionaryyAESDySSAEGcAEmF":{"name":"dictionary(_:)","abstract":"<p>A metadata value which is a dictionary from <code>String</code> to <code>Logger.MetadataValue</code>.</p>","parent_name":"MetadataValue"},"Structs/Logger/MetadataValue.html#/s:7Logging6LoggerV13MetadataValueO5arrayyAESayAEGcAEmF":{"name":"array(_:)","abstract":"<p>A metadata value which is an array of <code>Logger.MetadataValue</code>sLine truncated
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"warnings": [
|
||||
|
||||
],
|
||||
"source_directory": "/code"
|
||||
}
|
||||
@@ -1,162 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Enumerations Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="js/jquery.min.js" defer></script>
|
||||
<script src="js/jazzy.js" defer></script>
|
||||
|
||||
<script src="js/lunr.min.js" defer></script>
|
||||
<script src="js/typeahead.jquery.js" defer></script>
|
||||
<script src="js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Section/Enumerations" class="dashAnchor"></a>
|
||||
|
||||
<a title="Enumerations Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="index.html">
|
||||
Logging 1.4.2 Docs
|
||||
</a>
|
||||
(81% documented)
|
||||
</p>
|
||||
|
||||
<div class="header-col--secondary">
|
||||
<form role="search" action="search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="img/gh.png" alt="GitHub"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="dash-feed://https%3A%2F%2Fapple.github.io%2Fswift-log%2Fdocs%2F1.4.2%2FLogging%2Fdocsets%2FLogging.xml">
|
||||
<img class="header-icon" src="img/dash.png" alt="Dash"/>
|
||||
Install in Dash
|
||||
</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="index.html">Logging Reference</a>
|
||||
<img class="carat" src="img/carat.png" alt=""/>
|
||||
Enumerations Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SwiftLogNoOpLogHandler.html">SwiftLogNoOpLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>Enumerations</h1>
|
||||
<p>The following enumerations are available globally.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging0A6SystemO"></a>
|
||||
<a name="//apple_ref/swift/Enum/LoggingSystem" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging0A6SystemO">LoggingSystem</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>The <code>LoggingSystem</code> is a global facility where the default logging backend implementation (<code><a href="Protocols/LogHandler.html">LogHandler</a></code>) can be
|
||||
configured. <code>LoggingSystem</code> is set up just once in a given program to set up the desired logging backend
|
||||
implementation.</p>
|
||||
|
||||
<a href="Enums/LoggingSystem.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">LoggingSystem</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L652-L691">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2021 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external noopener">SwiftLog team</a>. All rights reserved. (Last updated: 2021-12-17)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,192 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>LoggingSystem Enumeration Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../js/jquery.min.js" defer></script>
|
||||
<script src="../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../js/lunr.min.js" defer></script>
|
||||
<script src="../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Enum/LoggingSystem" class="dashAnchor"></a>
|
||||
|
||||
<a title="LoggingSystem Enumeration Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
Logging 1.4.2 Docs
|
||||
</a>
|
||||
(81% documented)
|
||||
</p>
|
||||
|
||||
<div class="header-col--secondary">
|
||||
<form role="search" action="../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="../img/gh.png" alt="GitHub"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="dash-feed://https%3A%2F%2Fapple.github.io%2Fswift-log%2Fdocs%2F1.4.2%2FLogging%2Fdocsets%2FLogging.xml">
|
||||
<img class="header-icon" src="../img/dash.png" alt="Dash"/>
|
||||
Install in Dash
|
||||
</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">Logging Reference</a>
|
||||
<img class="carat" src="../img/carat.png" alt=""/>
|
||||
LoggingSystem Enumeration Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SwiftLogNoOpLogHandler.html">SwiftLogNoOpLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>LoggingSystem</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">LoggingSystem</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>The <code>LoggingSystem</code> is a global facility where the default logging backend implementation (<code><a href="../Protocols/LogHandler.html">LogHandler</a></code>) can be
|
||||
configured. <code>LoggingSystem</code> is set up just once in a given program to set up the desired logging backend
|
||||
implementation.</p>
|
||||
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L652-L691">Show on GitHub</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging0A6SystemO9bootstrapyyAA10LogHandler_pSScFZ"></a>
|
||||
<a name="//apple_ref/swift/Method/bootstrap(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging0A6SystemO9bootstrapyyAA10LogHandler_pSScFZ">bootstrap(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p><code>bootstrap</code> is a one-time configuration function which globally selects the desired logging backend
|
||||
implementation. <code>bootstrap</code> can be called at maximum once in any given program, calling it more than once will
|
||||
lead to undefined behavior, most likely a crash.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="nf">bootstrap</span><span class="p">(</span><span class="n">_</span> <span class="nv">factory</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt"><a href="../Protocols/LogHandler.html">LogHandler</a></span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>factory</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>A closure that given a <code><a href="../Structs/Logger.html">Logger</a></code> identifier, produces an instance of the <code><a href="../Protocols/LogHandler.html">LogHandler</a></code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L667-L679">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2021 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external noopener">SwiftLog team</a>. All rights reserved. (Last updated: 2021-12-17)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,255 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Protocols Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="js/jquery.min.js" defer></script>
|
||||
<script src="js/jazzy.js" defer></script>
|
||||
|
||||
<script src="js/lunr.min.js" defer></script>
|
||||
<script src="js/typeahead.jquery.js" defer></script>
|
||||
<script src="js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Section/Protocols" class="dashAnchor"></a>
|
||||
|
||||
<a title="Protocols Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="index.html">
|
||||
Logging 1.4.2 Docs
|
||||
</a>
|
||||
(81% documented)
|
||||
</p>
|
||||
|
||||
<div class="header-col--secondary">
|
||||
<form role="search" action="search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="img/gh.png" alt="GitHub"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="dash-feed://https%3A%2F%2Fapple.github.io%2Fswift-log%2Fdocs%2F1.4.2%2FLogging%2Fdocsets%2FLogging.xml">
|
||||
<img class="header-icon" src="img/dash.png" alt="Dash"/>
|
||||
Install in Dash
|
||||
</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="index.html">Logging Reference</a>
|
||||
<img class="carat" src="img/carat.png" alt=""/>
|
||||
Protocols Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SwiftLogNoOpLogHandler.html">SwiftLogNoOpLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>Protocols</h1>
|
||||
<p>The following protocols are available globally.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP"></a>
|
||||
<a name="//apple_ref/swift/Protocol/LogHandler" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP">LogHandler</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>A <code>LogHandler</code> is an implementation of a logging backend.</p>
|
||||
|
||||
<p>This type is an implementation detail and should not normally be used, unless implementing your own logging backend.
|
||||
To use the SwiftLog API, please refer to the documentation of <code><a href="Structs/Logger.html">Logger</a></code>.</p>
|
||||
<h1 id='implementation-requirements' class='heading'>Implementation requirements</h1>
|
||||
|
||||
<p>To implement your own <code>LogHandler</code> you should respect a few requirements that are necessary so applications work
|
||||
as expected regardless of the selected <code>LogHandler</code> implementation.</p>
|
||||
|
||||
<ul>
|
||||
<li>The <code>LogHandler</code> must be a <code>struct</code>.</li>
|
||||
<li>The metadata and <code>logLevel</code> properties must be implemented so that setting them on a <code><a href="Structs/Logger.html">Logger</a></code> does not affect
|
||||
other <code><a href="Structs/Logger.html">Logger</a></code>s.</li>
|
||||
</ul>
|
||||
<h3 id='treat-log-level-amp-metadata-as-values' class='heading'>Treat log level & metadata as values</h3>
|
||||
|
||||
<p>When developing your <code>LogHandler</code>, please make sure the following test works.</p>
|
||||
<pre class="highlight swift"><code><span class="kt">LoggingSystem</span><span class="o">.</span><span class="nf">bootstrap</span><span class="p">(</span><span class="kt">MyLogHandler</span><span class="o">.</span><span class="kd">init</span><span class="p">)</span> <span class="c1">// your LogHandler might have a different bootstrapping step</span>
|
||||
<span class="k">var</span> <span class="nv">logger1</span> <span class="o">=</span> <span class="kt">Logger</span><span class="p">(</span><span class="nv">label</span><span class="p">:</span> <span class="s">"first logger"</span><span class="p">)</span>
|
||||
<span class="n">logger1</span><span class="o">.</span><span class="n">logLevel</span> <span class="o">=</span> <span class="o">.</span><span class="n">debug</span>
|
||||
<span class="n">logger1</span><span class="p">[</span><span class="nv">metadataKey</span><span class="p">:</span> <span class="s">"only-on"</span><span class="p">]</span> <span class="o">=</span> <span class="s">"first"</span>
|
||||
|
||||
<span class="k">var</span> <span class="nv">logger2</span> <span class="o">=</span> <span class="n">logger1</span>
|
||||
<span class="n">logger2</span><span class="o">.</span><span class="n">logLevel</span> <span class="o">=</span> <span class="o">.</span><span class="n">error</span> <span class="c1">// this must not override `logger1`'s log level</span>
|
||||
<span class="n">logger2</span><span class="p">[</span><span class="nv">metadataKey</span><span class="p">:</span> <span class="s">"only-on"</span><span class="p">]</span> <span class="o">=</span> <span class="s">"second"</span> <span class="c1">// this must not override `logger1`'s metadata</span>
|
||||
|
||||
<span class="kt">XCTAssertEqual</span><span class="p">(</span><span class="o">.</span><span class="n">debug</span><span class="p">,</span> <span class="n">logger1</span><span class="o">.</span><span class="n">logLevel</span><span class="p">)</span>
|
||||
<span class="kt">XCTAssertEqual</span><span class="p">(</span><span class="o">.</span><span class="n">error</span><span class="p">,</span> <span class="n">logger2</span><span class="o">.</span><span class="n">logLevel</span><span class="p">)</span>
|
||||
<span class="kt">XCTAssertEqual</span><span class="p">(</span><span class="s">"first"</span><span class="p">,</span> <span class="n">logger1</span><span class="p">[</span><span class="nv">metadataKey</span><span class="p">:</span> <span class="s">"only-on"</span><span class="p">])</span>
|
||||
<span class="kt">XCTAssertEqual</span><span class="p">(</span><span class="s">"second"</span><span class="p">,</span> <span class="n">logger2</span><span class="p">[</span><span class="nv">metadataKey</span><span class="p">:</span> <span class="s">"only-on"</span><span class="p">])</span>
|
||||
</code></pre>
|
||||
<h3 id='special-cases' class='heading'>Special cases</h3>
|
||||
|
||||
<p>In certain special cases, the log level behaving like a value on <code><a href="Structs/Logger.html">Logger</a></code> might not be what you want. For example,
|
||||
you might want to set the log level across <em>all</em> <code><a href="Structs/Logger.html">Logger</a></code>s to <code>.debug</code> when say a signal (eg. <code>SIGUSR1</code>) is received
|
||||
to be able to debug special failures in production. This special case is acceptable but we urge you to create a
|
||||
solution specific to your <code>LogHandler</code> implementation to achieve that. Please find an example implementation of this
|
||||
behavior below, on reception of the signal you would call
|
||||
<code>LogHandlerWithGlobalLogLevelOverride.overrideGlobalLogLevel = .debug</code>, for example.</p>
|
||||
<pre class="highlight swift"><code><span class="kd">import</span> <span class="kd">class</span> <span class="kt">Foundation</span><span class="o">.</span><span class="kt">NSLock</span>
|
||||
|
||||
<span class="kd">public</span> <span class="kd">struct</span> <span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="p">:</span> <span class="kt">LogHandler</span> <span class="p">{</span>
|
||||
<span class="c1">// the static properties hold the globally overridden log level (if overridden)</span>
|
||||
<span class="kd">private</span> <span class="kd">static</span> <span class="k">let</span> <span class="nv">overrideLock</span> <span class="o">=</span> <span class="kt">NSLock</span><span class="p">()</span>
|
||||
<span class="kd">private</span> <span class="kd">static</span> <span class="k">var</span> <span class="nv">overrideLogLevel</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span>
|
||||
|
||||
<span class="c1">// this holds the log level if not overridden</span>
|
||||
<span class="kd">private</span> <span class="k">var</span> <span class="nv">_logLevel</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span> <span class="o">=</span> <span class="o">.</span><span class="n">info</span>
|
||||
|
||||
<span class="c1">// metadata storage</span>
|
||||
<span class="kd">public</span> <span class="k">var</span> <span class="nv">metadata</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Metadata</span> <span class="o">=</span> <span class="p">[:]</span>
|
||||
|
||||
<span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">label</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="p">{</span>
|
||||
<span class="c1">// [...]</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="kd">public</span> <span class="k">var</span> <span class="nv">logLevel</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span> <span class="p">{</span>
|
||||
<span class="c1">// when we get asked for the log level, we check if it was globally overridden or not</span>
|
||||
<span class="k">get</span> <span class="p">{</span>
|
||||
<span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLock</span><span class="o">.</span><span class="nf">lock</span><span class="p">()</span>
|
||||
<span class="k">defer</span> <span class="p">{</span> <span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLock</span><span class="o">.</span><span class="nf">unlock</span><span class="p">()</span> <span class="p">}</span>
|
||||
<span class="k">return</span> <span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLogLevel</span> <span class="p">??</span> <span class="k">self</span><span class="o">.</span><span class="n">_logLevel</span>
|
||||
<span class="p">}</span>
|
||||
<span class="c1">// we set the log level whenever we're asked (note: this might not have an effect if globally</span>
|
||||
<span class="c1">// overridden)</span>
|
||||
<span class="k">set</span> <span class="p">{</span>
|
||||
<span class="k">self</span><span class="o">.</span><span class="n">_logLevel</span> <span class="o">=</span> <span class="n">newValue</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">log</span><span class="p">(</span><span class="nv">level</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span><span class="p">,</span> <span class="nv">message</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Message</span><span class="p">,</span> <span class="nv">metadata</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Metadata</span><span class="p">?,</span>
|
||||
<span class="nv">source</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">file</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">function</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">line</span><span class="p">:</span> <span class="kt">UInt</span><span class="p">)</span> <span class="p">{</span>
|
||||
<span class="c1">// [...]</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="kd">public</span> <span class="nf">subscript</span><span class="p">(</span><span class="n">metadataKey</span> <span class="nv">metadataKey</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Metadata</span><span class="o">.</span><span class="kt">Value</span><span class="p">?</span> <span class="p">{</span>
|
||||
<span class="k">get</span> <span class="p">{</span>
|
||||
<span class="k">return</span> <span class="k">self</span><span class="o">.</span><span class="n">metadata</span><span class="p">[</span><span class="n">metadataKey</span><span class="p">]</span>
|
||||
<span class="p">}</span>
|
||||
<span class="nf">set</span><span class="p">(</span><span class="n">newValue</span><span class="p">)</span> <span class="p">{</span>
|
||||
<span class="k">self</span><span class="o">.</span><span class="n">metadata</span><span class="p">[</span><span class="n">metadataKey</span><span class="p">]</span> <span class="o">=</span> <span class="n">newValue</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="c1">// this is the function to globally override the log level, it is not part of the `LogHandler` protocol</span>
|
||||
<span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="nf">overrideGlobalLogLevel</span><span class="p">(</span><span class="n">_</span> <span class="nv">logLevel</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span><span class="p">)</span> <span class="p">{</span>
|
||||
<span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLock</span><span class="o">.</span><span class="nf">lock</span><span class="p">()</span>
|
||||
<span class="k">defer</span> <span class="p">{</span> <span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLock</span><span class="o">.</span><span class="nf">unlock</span><span class="p">()</span> <span class="p">}</span>
|
||||
<span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLogLevel</span> <span class="o">=</span> <span class="n">logLevel</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre>
|
||||
|
||||
<p>Please note that the above <code>LogHandler</code> will still pass the ‘log level is a value’ test above it iff the global log
|
||||
level has not been overridden. And most importantly it passes the requirement listed above: A change to the log
|
||||
level on one <code><a href="Structs/Logger.html">Logger</a></code> should not affect the log level of another <code><a href="Structs/Logger.html">Logger</a></code> variable.</p>
|
||||
|
||||
<a href="Protocols/LogHandler.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">LogHandler</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/LogHandler.swift#L116-L164">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2021 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external noopener">SwiftLog team</a>. All rights reserved. (Last updated: 2021-12-17)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,538 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>LogHandler Protocol Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../js/jquery.min.js" defer></script>
|
||||
<script src="../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../js/lunr.min.js" defer></script>
|
||||
<script src="../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Protocol/LogHandler" class="dashAnchor"></a>
|
||||
|
||||
<a title="LogHandler Protocol Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
Logging 1.4.2 Docs
|
||||
</a>
|
||||
(81% documented)
|
||||
</p>
|
||||
|
||||
<div class="header-col--secondary">
|
||||
<form role="search" action="../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="../img/gh.png" alt="GitHub"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="dash-feed://https%3A%2F%2Fapple.github.io%2Fswift-log%2Fdocs%2F1.4.2%2FLogging%2Fdocsets%2FLogging.xml">
|
||||
<img class="header-icon" src="../img/dash.png" alt="Dash"/>
|
||||
Install in Dash
|
||||
</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">Logging Reference</a>
|
||||
<img class="carat" src="../img/carat.png" alt=""/>
|
||||
LogHandler Protocol Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SwiftLogNoOpLogHandler.html">SwiftLogNoOpLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>LogHandler</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">LogHandler</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>A <code>LogHandler</code> is an implementation of a logging backend.</p>
|
||||
|
||||
<p>This type is an implementation detail and should not normally be used, unless implementing your own logging backend.
|
||||
To use the SwiftLog API, please refer to the documentation of <code><a href="../Structs/Logger.html">Logger</a></code>.</p>
|
||||
<h1 id='implementation-requirements' class='heading'>Implementation requirements</h1>
|
||||
|
||||
<p>To implement your own <code>LogHandler</code> you should respect a few requirements that are necessary so applications work
|
||||
as expected regardless of the selected <code>LogHandler</code> implementation.</p>
|
||||
|
||||
<ul>
|
||||
<li>The <code>LogHandler</code> must be a <code>struct</code>.</li>
|
||||
<li>The metadata and <code>logLevel</code> properties must be implemented so that setting them on a <code><a href="../Structs/Logger.html">Logger</a></code> does not affect
|
||||
other <code><a href="../Structs/Logger.html">Logger</a></code>s.</li>
|
||||
</ul>
|
||||
<h3 id='treat-log-level-amp-metadata-as-values' class='heading'>Treat log level & metadata as values</h3>
|
||||
|
||||
<p>When developing your <code>LogHandler</code>, please make sure the following test works.</p>
|
||||
<pre class="highlight swift"><code><span class="kt">LoggingSystem</span><span class="o">.</span><span class="nf">bootstrap</span><span class="p">(</span><span class="kt">MyLogHandler</span><span class="o">.</span><span class="kd">init</span><span class="p">)</span> <span class="c1">// your LogHandler might have a different bootstrapping step</span>
|
||||
<span class="k">var</span> <span class="nv">logger1</span> <span class="o">=</span> <span class="kt">Logger</span><span class="p">(</span><span class="nv">label</span><span class="p">:</span> <span class="s">"first logger"</span><span class="p">)</span>
|
||||
<span class="n">logger1</span><span class="o">.</span><span class="n">logLevel</span> <span class="o">=</span> <span class="o">.</span><span class="n">debug</span>
|
||||
<span class="n">logger1</span><span class="p">[</span><span class="nv">metadataKey</span><span class="p">:</span> <span class="s">"only-on"</span><span class="p">]</span> <span class="o">=</span> <span class="s">"first"</span>
|
||||
|
||||
<span class="k">var</span> <span class="nv">logger2</span> <span class="o">=</span> <span class="n">logger1</span>
|
||||
<span class="n">logger2</span><span class="o">.</span><span class="n">logLevel</span> <span class="o">=</span> <span class="o">.</span><span class="n">error</span> <span class="c1">// this must not override `logger1`'s log level</span>
|
||||
<span class="n">logger2</span><span class="p">[</span><span class="nv">metadataKey</span><span class="p">:</span> <span class="s">"only-on"</span><span class="p">]</span> <span class="o">=</span> <span class="s">"second"</span> <span class="c1">// this must not override `logger1`'s metadata</span>
|
||||
|
||||
<span class="kt">XCTAssertEqual</span><span class="p">(</span><span class="o">.</span><span class="n">debug</span><span class="p">,</span> <span class="n">logger1</span><span class="o">.</span><span class="n">logLevel</span><span class="p">)</span>
|
||||
<span class="kt">XCTAssertEqual</span><span class="p">(</span><span class="o">.</span><span class="n">error</span><span class="p">,</span> <span class="n">logger2</span><span class="o">.</span><span class="n">logLevel</span><span class="p">)</span>
|
||||
<span class="kt">XCTAssertEqual</span><span class="p">(</span><span class="s">"first"</span><span class="p">,</span> <span class="n">logger1</span><span class="p">[</span><span class="nv">metadataKey</span><span class="p">:</span> <span class="s">"only-on"</span><span class="p">])</span>
|
||||
<span class="kt">XCTAssertEqual</span><span class="p">(</span><span class="s">"second"</span><span class="p">,</span> <span class="n">logger2</span><span class="p">[</span><span class="nv">metadataKey</span><span class="p">:</span> <span class="s">"only-on"</span><span class="p">])</span>
|
||||
</code></pre>
|
||||
<h3 id='special-cases' class='heading'>Special cases</h3>
|
||||
|
||||
<p>In certain special cases, the log level behaving like a value on <code><a href="../Structs/Logger.html">Logger</a></code> might not be what you want. For example,
|
||||
you might want to set the log level across <em>all</em> <code><a href="../Structs/Logger.html">Logger</a></code>s to <code>.debug</code> when say a signal (eg. <code>SIGUSR1</code>) is received
|
||||
to be able to debug special failures in production. This special case is acceptable but we urge you to create a
|
||||
solution specific to your <code>LogHandler</code> implementation to achieve that. Please find an example implementation of this
|
||||
behavior below, on reception of the signal you would call
|
||||
<code>LogHandlerWithGlobalLogLevelOverride.overrideGlobalLogLevel = .debug</code>, for example.</p>
|
||||
<pre class="highlight swift"><code><span class="kd">import</span> <span class="kd">class</span> <span class="kt">Foundation</span><span class="o">.</span><span class="kt">NSLock</span>
|
||||
|
||||
<span class="kd">public</span> <span class="kd">struct</span> <span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="p">:</span> <span class="kt">LogHandler</span> <span class="p">{</span>
|
||||
<span class="c1">// the static properties hold the globally overridden log level (if overridden)</span>
|
||||
<span class="kd">private</span> <span class="kd">static</span> <span class="k">let</span> <span class="nv">overrideLock</span> <span class="o">=</span> <span class="kt">NSLock</span><span class="p">()</span>
|
||||
<span class="kd">private</span> <span class="kd">static</span> <span class="k">var</span> <span class="nv">overrideLogLevel</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span>
|
||||
|
||||
<span class="c1">// this holds the log level if not overridden</span>
|
||||
<span class="kd">private</span> <span class="k">var</span> <span class="nv">_logLevel</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span> <span class="o">=</span> <span class="o">.</span><span class="n">info</span>
|
||||
|
||||
<span class="c1">// metadata storage</span>
|
||||
<span class="kd">public</span> <span class="k">var</span> <span class="nv">metadata</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Metadata</span> <span class="o">=</span> <span class="p">[:]</span>
|
||||
|
||||
<span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">label</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="p">{</span>
|
||||
<span class="c1">// [...]</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="kd">public</span> <span class="k">var</span> <span class="nv">logLevel</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span> <span class="p">{</span>
|
||||
<span class="c1">// when we get asked for the log level, we check if it was globally overridden or not</span>
|
||||
<span class="k">get</span> <span class="p">{</span>
|
||||
<span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLock</span><span class="o">.</span><span class="nf">lock</span><span class="p">()</span>
|
||||
<span class="k">defer</span> <span class="p">{</span> <span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLock</span><span class="o">.</span><span class="nf">unlock</span><span class="p">()</span> <span class="p">}</span>
|
||||
<span class="k">return</span> <span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLogLevel</span> <span class="p">??</span> <span class="k">self</span><span class="o">.</span><span class="n">_logLevel</span>
|
||||
<span class="p">}</span>
|
||||
<span class="c1">// we set the log level whenever we're asked (note: this might not have an effect if globally</span>
|
||||
<span class="c1">// overridden)</span>
|
||||
<span class="k">set</span> <span class="p">{</span>
|
||||
<span class="k">self</span><span class="o">.</span><span class="n">_logLevel</span> <span class="o">=</span> <span class="n">newValue</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">log</span><span class="p">(</span><span class="nv">level</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span><span class="p">,</span> <span class="nv">message</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Message</span><span class="p">,</span> <span class="nv">metadata</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Metadata</span><span class="p">?,</span>
|
||||
<span class="nv">source</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">file</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">function</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">line</span><span class="p">:</span> <span class="kt">UInt</span><span class="p">)</span> <span class="p">{</span>
|
||||
<span class="c1">// [...]</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="kd">public</span> <span class="nf">subscript</span><span class="p">(</span><span class="n">metadataKey</span> <span class="nv">metadataKey</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Metadata</span><span class="o">.</span><span class="kt">Value</span><span class="p">?</span> <span class="p">{</span>
|
||||
<span class="k">get</span> <span class="p">{</span>
|
||||
<span class="k">return</span> <span class="k">self</span><span class="o">.</span><span class="n">metadata</span><span class="p">[</span><span class="n">metadataKey</span><span class="p">]</span>
|
||||
<span class="p">}</span>
|
||||
<span class="nf">set</span><span class="p">(</span><span class="n">newValue</span><span class="p">)</span> <span class="p">{</span>
|
||||
<span class="k">self</span><span class="o">.</span><span class="n">metadata</span><span class="p">[</span><span class="n">metadataKey</span><span class="p">]</span> <span class="o">=</span> <span class="n">newValue</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="c1">// this is the function to globally override the log level, it is not part of the `LogHandler` protocol</span>
|
||||
<span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="nf">overrideGlobalLogLevel</span><span class="p">(</span><span class="n">_</span> <span class="nv">logLevel</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Level</span><span class="p">)</span> <span class="p">{</span>
|
||||
<span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLock</span><span class="o">.</span><span class="nf">lock</span><span class="p">()</span>
|
||||
<span class="k">defer</span> <span class="p">{</span> <span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLock</span><span class="o">.</span><span class="nf">unlock</span><span class="p">()</span> <span class="p">}</span>
|
||||
<span class="kt">LogHandlerWithGlobalLogLevelOverride</span><span class="o">.</span><span class="n">overrideLogLevel</span> <span class="o">=</span> <span class="n">logLevel</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre>
|
||||
|
||||
<p>Please note that the above <code>LogHandler</code> will still pass the ‘log level is a value’ test above it iff the global log
|
||||
level has not been overridden. And most importantly it passes the requirement listed above: A change to the log
|
||||
level on one <code><a href="../Structs/Logger.html">Logger</a></code> should not affect the log level of another <code><a href="../Structs/Logger.html">Logger</a></code> variable.</p>
|
||||
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/LogHandler.swift#L116-L164">Show on GitHub</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP3log5level7message8metadata6source4file8function4lineyAA6LoggerV5LevelO_AM7MessageVSDySSAM13MetadataValueOGSgS3SSutF"></a>
|
||||
<a name="//apple_ref/swift/Method/log(level:message:metadata:source:file:function:line:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP3log5level7message8metadata6source4file8function4lineyAA6LoggerV5LevelO_AM7MessageVSDySSAM13MetadataValueOGSgS3SSutF">log(level:<wbr>message:<wbr>metadata:<wbr>source:<wbr>file:<wbr>function:<wbr>line:<wbr>)</a>
|
||||
</code>
|
||||
<span class="declaration-note">
|
||||
Default implementation
|
||||
</span>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>This method is called when a <code>LogHandler</code> must emit a log message. There is no need for the <code>LogHandler</code> to
|
||||
check if the <code>level</code> is above or below the configured <code><a href="../Protocols/LogHandler.html#/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp">logLevel</a></code> as <code><a href="../Structs/Logger.html">Logger</a></code> already performed this check and
|
||||
determined that a message should be logged.</p>
|
||||
|
||||
</div>
|
||||
<h4>Default Implementation</h4>
|
||||
<div class="default_impl abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">log</span><span class="p">(</span><span class="nv">level</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span><span class="p">,</span>
|
||||
<span class="nv">message</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Message</span><span class="p">,</span>
|
||||
<span class="nv">metadata</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span><span class="p">?,</span>
|
||||
<span class="nv">source</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">file</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">function</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">line</span><span class="p">:</span> <span class="kt">UInt</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>level</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The log level the message was logged at.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>message</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The message to log. To obtain a <code>String</code> representation call <code>message.description</code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>metadata</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The metadata associated to this log message.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>source</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The source where the log message originated, for example the logging module.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>file</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The file the log message was emitted from.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>function</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The function the log line was emitted from.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>line</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The line the log message was emitted from.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/LogHandler.swift#L129">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP3log5level7message8metadata4file8function4lineyAA6LoggerV5LevelO_AL7MessageVSDySSAL13MetadataValueOGSgS2SSutF"></a>
|
||||
<a name="//apple_ref/swift/Method/log(level:message:metadata:file:function:line:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP3log5level7message8metadata4file8function4lineyAA6LoggerV5LevelO_AL7MessageVSDySSAL13MetadataValueOGSgS2SSutF">log(level:<wbr>message:<wbr>metadata:<wbr>file:<wbr>function:<wbr>line:<wbr>)</a>
|
||||
</code>
|
||||
<span class="declaration-note">
|
||||
Default implementation
|
||||
</span>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>SwiftLog 1.0 compatibility method. Please do <em>not</em> implement, implement
|
||||
<code><a href="../Protocols/LogHandler.html#/s:7Logging10LogHandlerP3log5level7message8metadata6source4file8function4lineyAA6LoggerV5LevelO_AM7MessageVSDySSAM13MetadataValueOGSgS3SSutF">log(level:message:metadata:source:file:function:line:)</a></code> instead.</p>
|
||||
|
||||
</div>
|
||||
<h4>Default Implementation</h4>
|
||||
<div class="default_impl abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">@available</span><span class="p">(</span><span class="o">*</span><span class="p">,</span> <span class="n">deprecated</span><span class="p">,</span> <span class="nv">renamed</span><span class="p">:</span> <span class="s">"log(level:message:metadata:source:file:function:line:﹚"</span><span class="p">)</span>
|
||||
<span class="kd">func</span> <span class="nf">log</span><span class="p">(</span><span class="nv">level</span><span class="p">:</span> <span class="kt">Logging</span><span class="o">.</span><span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span><span class="p">,</span> <span class="nv">message</span><span class="p">:</span> <span class="kt">Logging</span><span class="o">.</span><span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Message</span><span class="p">,</span> <span class="nv">metadata</span><span class="p">:</span> <span class="kt">Logging</span><span class="o">.</span><span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span><span class="p">?,</span> <span class="nv">file</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">function</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">line</span><span class="p">:</span> <span class="kt">UInt</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/LogHandler.swift#L140">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP11metadataKeyAA6LoggerV13MetadataValueOSgSS_tcip"></a>
|
||||
<a name="//apple_ref/swift/Method/subscript(metadataKey:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP11metadataKeyAA6LoggerV13MetadataValueOSgSS_tcip">subscript(metadataKey:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Add, remove, or change the logging metadata.</p>
|
||||
<div class="aside aside-note">
|
||||
<p class="aside-title">Note</p>
|
||||
<p><code>LogHandler</code>s must treat logging metadata as a value type. This means that the change in metadata must
|
||||
only affect this very <code>LogHandler</code>.</p>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="nf">subscript</span><span class="p">(</span><span class="n">metadataKey</span> <span class="nv">_</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span><span class="o">.</span><span class="kt">Value</span><span class="p">?</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>metadataKey</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The key for the metadata item</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/LogHandler.swift#L149">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP8metadataSDySSAA6LoggerV13MetadataValueOGvp"></a>
|
||||
<a name="//apple_ref/swift/Property/metadata" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP8metadataSDySSAA6LoggerV13MetadataValueOGvp">metadata</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Get or set the entire metadata storage as a dictionary.</p>
|
||||
<div class="aside aside-note">
|
||||
<p class="aside-title">Note</p>
|
||||
<code>LogHandler</code>s must treat logging metadata as a value type. This means that the change in metadata must
|
||||
only affect this very <code>LogHandler</code>.
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">var</span> <span class="nv">metadata</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/LogHandler.swift#L155">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp"></a>
|
||||
<a name="//apple_ref/swift/Property/logLevel" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp">logLevel</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Get or set the configured log level.</p>
|
||||
<div class="aside aside-note">
|
||||
<p class="aside-title">Note</p>
|
||||
<code>LogHandler</code>s must treat the log level as a value type. This means that the change in metadata must
|
||||
only affect this very <code>LogHandler</code>. It is acceptable to provide some form of global log level override
|
||||
that means a change in log level on a particular <code>LogHandler</code> might not be reflected in any
|
||||
<code>LogHandler</code>.
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">var</span> <span class="nv">logLevel</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/LogHandler.swift#L163">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2021 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external noopener">SwiftLog team</a>. All rights reserved. (Last updated: 2021-12-17)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,305 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Structures Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="js/jquery.min.js" defer></script>
|
||||
<script src="js/jazzy.js" defer></script>
|
||||
|
||||
<script src="js/lunr.min.js" defer></script>
|
||||
<script src="js/typeahead.jquery.js" defer></script>
|
||||
<script src="js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Section/Structures" class="dashAnchor"></a>
|
||||
|
||||
<a title="Structures Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="index.html">
|
||||
Logging 1.4.2 Docs
|
||||
</a>
|
||||
(81% documented)
|
||||
</p>
|
||||
|
||||
<div class="header-col--secondary">
|
||||
<form role="search" action="search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="img/gh.png" alt="GitHub"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="dash-feed://https%3A%2F%2Fapple.github.io%2Fswift-log%2Fdocs%2F1.4.2%2FLogging%2Fdocsets%2FLogging.xml">
|
||||
<img class="header-icon" src="img/dash.png" alt="Dash"/>
|
||||
Install in Dash
|
||||
</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="index.html">Logging Reference</a>
|
||||
<img class="carat" src="img/carat.png" alt=""/>
|
||||
Structures Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SwiftLogNoOpLogHandler.html">SwiftLogNoOpLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>Structures</h1>
|
||||
<p>The following structures are available globally.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV"></a>
|
||||
<a name="//apple_ref/swift/Struct/Logger" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV">Logger</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>A <code>Logger</code> is the central type in <code>SwiftLog</code>. Its central function is to emit log messages using one of the methods
|
||||
corresponding to a log level.</p>
|
||||
|
||||
<p><code>Logger</code>s are value types with respect to the <code>logLevel</code> and the <code>metadata</code> (as well as the immutable <code>label</code>
|
||||
and the selected <code><a href="Protocols/LogHandler.html">LogHandler</a></code>). Therefore, <code>Logger</code>s are suitable to be passed around between libraries if you want
|
||||
to preserve metadata across libraries.</p>
|
||||
|
||||
<p>The most basic usage of a <code>Logger</code> is</p>
|
||||
<pre class="highlight swift"><code><span class="n">logger</span><span class="o">.</span><span class="nf">info</span><span class="p">(</span><span class="s">"Hello World!"</span><span class="p">)</span>
|
||||
</code></pre>
|
||||
|
||||
<a href="Structs/Logger.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Logger</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L38-L49">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging19MultiplexLogHandlerV"></a>
|
||||
<a name="//apple_ref/swift/Struct/MultiplexLogHandler" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging19MultiplexLogHandlerV">MultiplexLogHandler</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>A pseudo-<code><a href="Protocols/LogHandler.html">LogHandler</a></code> that can be used to send messages to multiple other <code><a href="Protocols/LogHandler.html">LogHandler</a></code>s.</p>
|
||||
<h3 id='effective-logger-level' class='heading'>Effective Logger.Level</h3>
|
||||
|
||||
<p>When first initialized the multiplex log handlers’ log level is automatically set to the minimum of all the
|
||||
passed in log handlers. This ensures that each of the handlers will be able to log at their appropriate level
|
||||
any log events they might be interested in.</p>
|
||||
|
||||
<p>Example:
|
||||
If log handler <code>A</code> is logging at <code>.debug</code> level, and log handler <code>B</code> is logging at <code>.info</code> level, the constructed
|
||||
<code>MultiplexLogHandler([A, B])</code>‘s effective log level will be set to <code>.debug</code>, meaning that debug messages will be
|
||||
handled by this handler, while only logged by the underlying <code>A</code> log handler (since <code>B</code>’s log level is <code>.info</code>
|
||||
and thus it would not actually log that log message).</p>
|
||||
|
||||
<p>If the log level is <em>set</em> on a <code><a href="Structs/Logger.html">Logger</a></code> backed by an <code>MultiplexLogHandler</code> the log level will apply to <em>all</em>
|
||||
underlying log handlers, allowing a logger to still select at what level it wants to log regardless of if the underlying
|
||||
handler is a multiplex or a normal one. If for some reason one might want to not allow changing a log level of a specific
|
||||
handler passed into the multiplex log handler, this is possible by wrapping it in a handler which ignores any log level changes.</p>
|
||||
<h3 id='effective-logger-metadata' class='heading'>Effective Logger.Metadata</h3>
|
||||
|
||||
<p>Since a <code>MultiplexLogHandler</code> is a combination of multiple log handlers, the handling of metadata can be non-obvious.
|
||||
For example, the underlying log handlers may have metadata of their own set before they are used to initialize the multiplex log handler.</p>
|
||||
|
||||
<p>The multiplex log handler acts purely as proxy and does not make any changes to underlying handler metadata other than
|
||||
proxying writes that users made on a <code><a href="Structs/Logger.html">Logger</a></code> instance backed by this handler.</p>
|
||||
|
||||
<p>Setting metadata is always proxied through to <em>all</em> underlying handlers, meaning that if a modification like
|
||||
<code>logger[metadataKey: "x"] = "y"</code> is made, all underlying log handlers that this multiplex handler was initiated with
|
||||
will observe this change.</p>
|
||||
|
||||
<p>Reading metadata from the multiplex log handler MAY need to pick one of conflicting values if the underlying log handlers
|
||||
were already initiated with some metadata before passing them into the multiplex handler. The multiplex handler uses
|
||||
the order in which the handlers were passed in during its initialization as a priority indicator - the first handler’s
|
||||
values are more important than the next handlers values, etc.</p>
|
||||
|
||||
<p>Example:
|
||||
If the multiplex log handler was initiated with two handlers like this: <code>MultiplexLogHandler([handler1, handler2])</code>.
|
||||
The handlers each have some already set metadata: <code>handler1</code> has metadata values for keys <code>one</code> and <code>all</code>, and <code>handler2</code>
|
||||
has values for keys <code>two</code> and <code>all</code>.</p>
|
||||
|
||||
<p>A query through the multiplex log handler the key <code>one</code> naturally returns <code>handler1</code>’s value, and a query for <code>two</code>
|
||||
naturally returns <code>handler2</code>’s value. Querying for the key <code>all</code> will return <code>handler1</code>’s value, as that handler was indicated
|
||||
“more important” than the second handler. The same rule applies when querying for the <code>metadata</code> property of the
|
||||
multiplex log handler - it constructs <code>Metadata</code> uniquing values.</p>
|
||||
|
||||
<a href="Structs/MultiplexLogHandler.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">MultiplexLogHandler</span> <span class="p">:</span> <span class="kt"><a href="Protocols/LogHandler.html">LogHandler</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L920-L991">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging16StreamLogHandlerV"></a>
|
||||
<a name="//apple_ref/swift/Struct/StreamLogHandler" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging16StreamLogHandlerV">StreamLogHandler</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p><code>StreamLogHandler</code> is a simple implementation of <code><a href="Protocols/LogHandler.html">LogHandler</a></code> for directing
|
||||
<code><a href="Structs/Logger.html">Logger</a></code> output to either <code>stderr</code> or <code>stdout</code> via the factory methods.</p>
|
||||
|
||||
<a href="Structs/StreamLogHandler.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">StreamLogHandler</span> <span class="p">:</span> <span class="kt"><a href="Protocols/LogHandler.html">LogHandler</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L1076-L1156">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging012SwiftLogNoOpC7HandlerV"></a>
|
||||
<a name="//apple_ref/swift/Struct/SwiftLogNoOpLogHandler" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging012SwiftLogNoOpC7HandlerV">SwiftLogNoOpLogHandler</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>No operation LogHandler, used when no logging is required</p>
|
||||
|
||||
<a href="Structs/SwiftLogNoOpLogHandler.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SwiftLogNoOpLogHandler</span> <span class="p">:</span> <span class="kt"><a href="Protocols/LogHandler.html">LogHandler</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L1159-L1186">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2021 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external noopener">SwiftLog team</a>. All rights reserved. (Last updated: 2021-12-17)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,391 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Level Enumeration Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../../js/jquery.min.js" defer></script>
|
||||
<script src="../../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../../js/lunr.min.js" defer></script>
|
||||
<script src="../../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Enum/Level" class="dashAnchor"></a>
|
||||
|
||||
<a title="Level Enumeration Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../../index.html">
|
||||
Logging 1.4.2 Docs
|
||||
</a>
|
||||
(81% documented)
|
||||
</p>
|
||||
|
||||
<div class="header-col--secondary">
|
||||
<form role="search" action="../../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="../../img/gh.png" alt="GitHub"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="dash-feed://https%3A%2F%2Fapple.github.io%2Fswift-log%2Fdocs%2F1.4.2%2FLogging%2Fdocsets%2FLogging.xml">
|
||||
<img class="header-icon" src="../../img/dash.png" alt="Dash"/>
|
||||
Install in Dash
|
||||
</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../../index.html">Logging Reference</a>
|
||||
<img class="carat" src="../../img/carat.png" alt=""/>
|
||||
Level Enumeration Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/SwiftLogNoOpLogHandler.html">SwiftLogNoOpLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>Level</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Level</span> <span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="kt">Codable</span><span class="p">,</span> <span class="kt">CaseIterable</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span><span class="p">:</span> <span class="kt">Comparable</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>The log level.</p>
|
||||
|
||||
<p>Log levels are ordered by their severity, with <code>.trace</code> being the least severe and
|
||||
<code>.critical</code> being the most severe.</p>
|
||||
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L737-L767">Show on GitHub</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV5LevelO5traceyA2EmF"></a>
|
||||
<a name="//apple_ref/swift/Element/trace" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV5LevelO5traceyA2EmF">trace</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Appropriate for messages that contain information normally of use only when
|
||||
tracing the execution of a program.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">trace</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L740">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV5LevelO5debugyA2EmF"></a>
|
||||
<a name="//apple_ref/swift/Element/debug" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV5LevelO5debugyA2EmF">debug</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Appropriate for messages that contain information normally of use only when
|
||||
debugging a program.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">debug</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L744">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV5LevelO4infoyA2EmF"></a>
|
||||
<a name="//apple_ref/swift/Element/info" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV5LevelO4infoyA2EmF">info</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Appropriate for informational messages.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">info</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L747">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV5LevelO6noticeyA2EmF"></a>
|
||||
<a name="//apple_ref/swift/Element/notice" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV5LevelO6noticeyA2EmF">notice</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Appropriate for conditions that are not error conditions, but that may require
|
||||
special handling.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">notice</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L751">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV5LevelO7warningyA2EmF"></a>
|
||||
<a name="//apple_ref/swift/Element/warning" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV5LevelO7warningyA2EmF">warning</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Appropriate for messages that are not error conditions, but more severe than
|
||||
<code><a href="../../Structs/Logger/Level.html#/s:7Logging6LoggerV5LevelO6noticeyA2EmF">.notice</a></code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">warning</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L755">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV5LevelO5erroryA2EmF"></a>
|
||||
<a name="//apple_ref/swift/Element/error" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV5LevelO5erroryA2EmF">error</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Appropriate for error conditions.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">error</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L758">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV5LevelO8criticalyA2EmF"></a>
|
||||
<a name="//apple_ref/swift/Element/critical" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV5LevelO8criticalyA2EmF">critical</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Appropriate for critical error conditions that usually require immediate
|
||||
attention.</p>
|
||||
|
||||
<p>When a <code>critical</code> message is logged, the logging backend (<code><a href="../../Protocols/LogHandler.html">LogHandler</a></code>) is free to perform
|
||||
more heavy-weight operations to capture system state (such as capturing stack traces) to facilitate
|
||||
debugging.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">critical</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L766">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:SL1loiySbx_xtFZ"></a>
|
||||
<a name="//apple_ref/swift/Method/<(_:_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:SL1loiySbx_xtFZ"><(_:<wbr>_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o"><</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span><span class="p">,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span><span class="p">)</span> <span class="o">-></span> <span class="kt">Bool</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L822-L824">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2021 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external noopener">SwiftLog team</a>. All rights reserved. (Last updated: 2021-12-17)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,235 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Message Structure Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../../js/jquery.min.js" defer></script>
|
||||
<script src="../../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../../js/lunr.min.js" defer></script>
|
||||
<script src="../../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Struct/Message" class="dashAnchor"></a>
|
||||
|
||||
<a title="Message Structure Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../../index.html">
|
||||
Logging 1.4.2 Docs
|
||||
</a>
|
||||
(81% documented)
|
||||
</p>
|
||||
|
||||
<div class="header-col--secondary">
|
||||
<form role="search" action="../../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="../../img/gh.png" alt="GitHub"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="dash-feed://https%3A%2F%2Fapple.github.io%2Fswift-log%2Fdocs%2F1.4.2%2FLogging%2Fdocsets%2FLogging.xml">
|
||||
<img class="header-icon" src="../../img/dash.png" alt="Dash"/>
|
||||
Install in Dash
|
||||
</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../../index.html">Logging Reference</a>
|
||||
<img class="carat" src="../../img/carat.png" alt=""/>
|
||||
Message Structure Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/SwiftLogNoOpLogHandler.html">SwiftLogNoOpLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>Message</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Message</span> <span class="p">:</span> <span class="kt">ExpressibleByStringLiteral</span><span class="p">,</span> <span class="kt">Equatable</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span><span class="p">,</span> <span class="kt">ExpressibleByStringInterpolation</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p><code>Logger.Message</code> represents a log message’s text. It is usually created using string literals.</p>
|
||||
|
||||
<p>Example creating a <code>Logger.Message</code>:</p>
|
||||
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">world</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"world"</span>
|
||||
<span class="k">let</span> <span class="nv">myLogMessage</span><span class="p">:</span> <span class="kt">Logger</span><span class="o">.</span><span class="kt">Message</span> <span class="o">=</span> <span class="s">"Hello </span><span class="se">\(</span><span class="n">world</span><span class="se">)</span><span class="s">"</span>
|
||||
</code></pre>
|
||||
|
||||
<p>Most commonly, <code>Logger.Message</code>s appear simply as the parameter to a logging method such as:</p>
|
||||
<pre class="highlight swift"><code><span class="n">logger</span><span class="o">.</span><span class="nf">info</span><span class="p">(</span><span class="s">"Hello </span><span class="se">\(</span><span class="n">world</span><span class="se">)</span><span class="s">"</span><span class="p">)</span>
|
||||
</code></pre>
|
||||
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L860-L872">Show on GitHub</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s26ExpressibleByStringLiteralP0cD4TypeQa"></a>
|
||||
<a name="//apple_ref/swift/Alias/StringLiteralType" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s26ExpressibleByStringLiteralP0cD4TypeQa">StringLiteralType</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">StringLiteralType</span> <span class="o">=</span> <span class="kt">String</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s26ExpressibleByStringLiteralP06stringD0x0cD4TypeQz_tcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(stringLiteral:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s26ExpressibleByStringLiteralP06stringD0x0cD4TypeQz_tcfc">init(stringLiteral:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">stringLiteral</span> <span class="nv">value</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L865-L867">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s23CustomStringConvertibleP11descriptionSSvp"></a>
|
||||
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s23CustomStringConvertibleP11descriptionSSvp">description</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L869-L871">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2021 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external noopener">SwiftLog team</a>. All rights reserved. (Last updated: 2021-12-17)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,550 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>MetadataValue Enumeration Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../../js/jquery.min.js" defer></script>
|
||||
<script src="../../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../../js/lunr.min.js" defer></script>
|
||||
<script src="../../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Enum/MetadataValue" class="dashAnchor"></a>
|
||||
|
||||
<a title="MetadataValue Enumeration Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../../index.html">
|
||||
Logging 1.4.2 Docs
|
||||
</a>
|
||||
(81% documented)
|
||||
</p>
|
||||
|
||||
<div class="header-col--secondary">
|
||||
<form role="search" action="../../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="../../img/gh.png" alt="GitHub"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="dash-feed://https%3A%2F%2Fapple.github.io%2Fswift-log%2Fdocs%2F1.4.2%2FLogging%2Fdocsets%2FLogging.xml">
|
||||
<img class="header-icon" src="../../img/dash.png" alt="Dash"/>
|
||||
Install in Dash
|
||||
</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../../index.html">Logging Reference</a>
|
||||
<img class="carat" src="../../img/carat.png" alt=""/>
|
||||
MetadataValue Enumeration Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/SwiftLogNoOpLogHandler.html">SwiftLogNoOpLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>MetadataValue</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">MetadataValue</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">MetadataValue</span><span class="p">:</span> <span class="kt">Equatable</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">MetadataValue</span><span class="p">:</span> <span class="kt">ExpressibleByStringLiteral</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">MetadataValue</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">MetadataValue</span><span class="p">:</span> <span class="kt">ExpressibleByStringInterpolation</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">MetadataValue</span><span class="p">:</span> <span class="kt">ExpressibleByDictionaryLiteral</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">MetadataValue</span><span class="p">:</span> <span class="kt">ExpressibleByArrayLiteral</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>A logging metadata value. <code>Logger.MetadataValue</code> is string, array, and dictionary literal convertible.</p>
|
||||
|
||||
<p><code>MetadataValue</code> provides convenient conformances to <code>ExpressibleByStringInterpolation</code>,
|
||||
<code>ExpressibleByStringLiteral</code>, <code>ExpressibleByArrayLiteral</code>, and <code>ExpressibleByDictionaryLiteral</code> which means
|
||||
that when constructing <code>MetadataValue</code>s you should default to using Swift’s usual literals.</p>
|
||||
|
||||
<p>Examples:</p>
|
||||
|
||||
<ul>
|
||||
<li>prefer <code>logger.info("user logged in", metadata: ["user-id": "\(user.id)"])</code> over
|
||||
<code>..., metadata: ["user-id": .string(user.id.description)])</code></li>
|
||||
<li>prefer <code>logger.info("user selected colors", metadata: ["colors": ["\(user.topColor)", "\(user.secondColor)"]])</code>
|
||||
over <code>..., metadata: ["colors": .array([.string("\(user.topColor)"), .string("\(user.secondColor)")])</code></li>
|
||||
<li>prefer <code>logger.info("nested info", metadata: ["nested": ["fave-numbers": ["\(1)", "\(2)", "\(3)"], "foo": "bar"]])</code>
|
||||
over <code>..., metadata: ["nested": .dictionary(["fave-numbers": ...])])</code></li>
|
||||
</ul>
|
||||
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L710-L731">Show on GitHub</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV13MetadataValueO6stringyAESScAEmF"></a>
|
||||
<a name="//apple_ref/swift/Element/string(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV13MetadataValueO6stringyAESScAEmF">string(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>A metadata value which is a <code>String</code>.</p>
|
||||
|
||||
<p>Because <code>MetadataValue</code> implements <code>ExpressibleByStringInterpolation</code>, and <code>ExpressibleByStringLiteral</code>,
|
||||
you don’t need to type <code>.string(someType.description)</code> you can use the string interpolation <code>"\(someType)"</code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">string</span><span class="p">(</span><span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L715">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV13MetadataValueO17stringConvertibleyAEs012CustomStringF0_pcAEmF"></a>
|
||||
<a name="//apple_ref/swift/Element/stringConvertible(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV13MetadataValueO17stringConvertibleyAEs012CustomStringF0_pcAEmF">stringConvertible(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>A metadata value which is some <code>CustomStringConvertible</code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">stringConvertible</span><span class="p">(</span><span class="kt">CustomStringConvertible</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L718">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV13MetadataValueO10dictionaryyAESDySSAEGcAEmF"></a>
|
||||
<a name="//apple_ref/swift/Element/dictionary(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV13MetadataValueO10dictionaryyAESDySSAEGcAEmF">dictionary(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>A metadata value which is a dictionary from <code>String</code> to <code>Logger.MetadataValue</code>.</p>
|
||||
|
||||
<p>Because <code>MetadataValue</code> implements <code>ExpressibleByDictionaryLiteral</code>, you don’t need to type
|
||||
<code>.dictionary(["foo": .string("bar \(buz)")])</code>, you can just use the more natural <code>["foo": "bar \(buz)"]</code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">dictionary</span><span class="p">(</span><span class="kt"><a href="../../Structs/Logger.html#/s:7Logging6LoggerV8Metadataa">Metadata</a></span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L724">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging6LoggerV13MetadataValueO5arrayyAESayAEGcAEmF"></a>
|
||||
<a name="//apple_ref/swift/Element/array(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging6LoggerV13MetadataValueO5arrayyAESayAEGcAEmF">array(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>A metadata value which is an array of <code>Logger.MetadataValue</code>s.</p>
|
||||
|
||||
<p>Because <code>MetadataValue</code> implements <code>ExpressibleByArrayLiteral</code>, you don’t need to type
|
||||
<code>.array([.string("foo"), .string("bar \(buz)")])</code>, you can just use the more natural <code>["foo", "bar \(buz)"]</code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">array</span><span class="p">([</span><span class="kt"><a href="../../Structs/Logger.html#/s:7Logging6LoggerV8Metadataa">Metadata</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger/MetadataValue.html#/s:s30ExpressibleByDictionaryLiteralP5ValueQa">Value</a></span><span class="p">])</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L730">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:SQ2eeoiySbx_xtFZ"></a>
|
||||
<a name="//apple_ref/swift/Method/==(_:_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:SQ2eeoiySbx_xtFZ">==(_:<wbr>_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger.html#/s:7Logging6LoggerV8Metadataa">Metadata</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger/MetadataValue.html#/s:s30ExpressibleByDictionaryLiteralP5ValueQa">Value</a></span><span class="p">,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger.html#/s:7Logging6LoggerV8Metadataa">Metadata</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger/MetadataValue.html#/s:s30ExpressibleByDictionaryLiteralP5ValueQa">Value</a></span><span class="p">)</span> <span class="o">-></span> <span class="kt">Bool</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L832-L845">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s26ExpressibleByStringLiteralP0cD4TypeQa"></a>
|
||||
<a name="//apple_ref/swift/Alias/StringLiteralType" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s26ExpressibleByStringLiteralP0cD4TypeQa">StringLiteralType</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">StringLiteralType</span> <span class="o">=</span> <span class="kt">String</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s26ExpressibleByStringLiteralP06stringD0x0cD4TypeQz_tcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(stringLiteral:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s26ExpressibleByStringLiteralP06stringD0x0cD4TypeQz_tcfc">init(stringLiteral:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">stringLiteral</span> <span class="nv">value</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L1219-L1221">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s23CustomStringConvertibleP11descriptionSSvp"></a>
|
||||
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s23CustomStringConvertibleP11descriptionSSvp">description</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L1227-L1238">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s30ExpressibleByDictionaryLiteralP3KeyQa"></a>
|
||||
<a name="//apple_ref/swift/Alias/Key" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s30ExpressibleByDictionaryLiteralP3KeyQa">Key</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Key</span> <span class="o">=</span> <span class="kt">String</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s30ExpressibleByDictionaryLiteralP5ValueQa"></a>
|
||||
<a name="//apple_ref/swift/Alias/Value" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s30ExpressibleByDictionaryLiteralP5ValueQa">Value</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Value</span> <span class="o">=</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger.html#/s:7Logging6LoggerV8Metadataa">Metadata</a></span><span class="o">.</span><span class="kt">Value</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s30ExpressibleByDictionaryLiteralP010dictionaryD0x3KeyQz_5ValueQztd_tcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(dictionaryLiteral:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s30ExpressibleByDictionaryLiteralP010dictionaryD0x3KeyQz_5ValueQztd_tcfc">init(dictionaryLiteral:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">dictionaryLiteral</span> <span class="nv">elements</span><span class="p">:</span> <span class="p">(</span><span class="kt">String</span><span class="p">,</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger.html#/s:7Logging6LoggerV8Metadataa">Metadata</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger/MetadataValue.html#/s:s30ExpressibleByDictionaryLiteralP5ValueQa">Value</a></span><span class="p">)</span><span class="o">...</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L1251-L1253">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s25ExpressibleByArrayLiteralP0cD7ElementQa"></a>
|
||||
<a name="//apple_ref/swift/Alias/ArrayLiteralElement" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s25ExpressibleByArrayLiteralP0cD7ElementQa">ArrayLiteralElement</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">ArrayLiteralElement</span> <span class="o">=</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger.html#/s:7Logging6LoggerV8Metadataa">Metadata</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger/MetadataValue.html#/s:s30ExpressibleByDictionaryLiteralP5ValueQa">Value</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s25ExpressibleByArrayLiteralP05arrayD0x0cD7ElementQzd_tcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(arrayLiteral:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s25ExpressibleByArrayLiteralP05arrayD0x0cD7ElementQzd_tcfc">init(arrayLiteral:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">arrayLiteral</span> <span class="nv">elements</span><span class="p">:</span> <span class="kt"><a href="../../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger.html#/s:7Logging6LoggerV8Metadataa">Metadata</a></span><span class="o">.</span><span class="kt"><a href="../../Structs/Logger/MetadataValue.html#/s:s30ExpressibleByDictionaryLiteralP5ValueQa">Value</a></span><span class="o">...</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L1261-L1263">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2021 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external noopener">SwiftLog team</a>. All rights reserved. (Last updated: 2021-12-17)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,353 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>MultiplexLogHandler Structure Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../js/jquery.min.js" defer></script>
|
||||
<script src="../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../js/lunr.min.js" defer></script>
|
||||
<script src="../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Struct/MultiplexLogHandler" class="dashAnchor"></a>
|
||||
|
||||
<a title="MultiplexLogHandler Structure Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
Logging 1.4.2 Docs
|
||||
</a>
|
||||
(81% documented)
|
||||
</p>
|
||||
|
||||
<div class="header-col--secondary">
|
||||
<form role="search" action="../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="../img/gh.png" alt="GitHub"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="dash-feed://https%3A%2F%2Fapple.github.io%2Fswift-log%2Fdocs%2F1.4.2%2FLogging%2Fdocsets%2FLogging.xml">
|
||||
<img class="header-icon" src="../img/dash.png" alt="Dash"/>
|
||||
Install in Dash
|
||||
</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">Logging Reference</a>
|
||||
<img class="carat" src="../img/carat.png" alt=""/>
|
||||
MultiplexLogHandler Structure Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SwiftLogNoOpLogHandler.html">SwiftLogNoOpLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>MultiplexLogHandler</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">MultiplexLogHandler</span> <span class="p">:</span> <span class="kt"><a href="../Protocols/LogHandler.html">LogHandler</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>A pseudo-<code><a href="../Protocols/LogHandler.html">LogHandler</a></code> that can be used to send messages to multiple other <code><a href="../Protocols/LogHandler.html">LogHandler</a></code>s.</p>
|
||||
<h3 id='effective-logger-level' class='heading'>Effective Logger.Level</h3>
|
||||
|
||||
<p>When first initialized the multiplex log handlers’ log level is automatically set to the minimum of all the
|
||||
passed in log handlers. This ensures that each of the handlers will be able to log at their appropriate level
|
||||
any log events they might be interested in.</p>
|
||||
|
||||
<p>Example:
|
||||
If log handler <code>A</code> is logging at <code>.debug</code> level, and log handler <code>B</code> is logging at <code>.info</code> level, the constructed
|
||||
<code>MultiplexLogHandler([A, B])</code>‘s effective log level will be set to <code>.debug</code>, meaning that debug messages will be
|
||||
handled by this handler, while only logged by the underlying <code>A</code> log handler (since <code>B</code>’s log level is <code>.info</code>
|
||||
and thus it would not actually log that log message).</p>
|
||||
|
||||
<p>If the log level is <em>set</em> on a <code><a href="../Structs/Logger.html">Logger</a></code> backed by an <code>MultiplexLogHandler</code> the log level will apply to <em>all</em>
|
||||
underlying log handlers, allowing a logger to still select at what level it wants to log regardless of if the underlying
|
||||
handler is a multiplex or a normal one. If for some reason one might want to not allow changing a log level of a specific
|
||||
handler passed into the multiplex log handler, this is possible by wrapping it in a handler which ignores any log level changes.</p>
|
||||
<h3 id='effective-logger-metadata' class='heading'>Effective Logger.Metadata</h3>
|
||||
|
||||
<p>Since a <code>MultiplexLogHandler</code> is a combination of multiple log handlers, the handling of metadata can be non-obvious.
|
||||
For example, the underlying log handlers may have metadata of their own set before they are used to initialize the multiplex log handler.</p>
|
||||
|
||||
<p>The multiplex log handler acts purely as proxy and does not make any changes to underlying handler metadata other than
|
||||
proxying writes that users made on a <code><a href="../Structs/Logger.html">Logger</a></code> instance backed by this handler.</p>
|
||||
|
||||
<p>Setting metadata is always proxied through to <em>all</em> underlying handlers, meaning that if a modification like
|
||||
<code>logger[metadataKey: "x"] = "y"</code> is made, all underlying log handlers that this multiplex handler was initiated with
|
||||
will observe this change.</p>
|
||||
|
||||
<p>Reading metadata from the multiplex log handler MAY need to pick one of conflicting values if the underlying log handlers
|
||||
were already initiated with some metadata before passing them into the multiplex handler. The multiplex handler uses
|
||||
the order in which the handlers were passed in during its initialization as a priority indicator - the first handler’s
|
||||
values are more important than the next handlers values, etc.</p>
|
||||
|
||||
<p>Example:
|
||||
If the multiplex log handler was initiated with two handlers like this: <code>MultiplexLogHandler([handler1, handler2])</code>.
|
||||
The handlers each have some already set metadata: <code>handler1</code> has metadata values for keys <code>one</code> and <code>all</code>, and <code>handler2</code>
|
||||
has values for keys <code>two</code> and <code>all</code>.</p>
|
||||
|
||||
<p>A query through the multiplex log handler the key <code>one</code> naturally returns <code>handler1</code>’s value, and a query for <code>two</code>
|
||||
naturally returns <code>handler2</code>’s value. Querying for the key <code>all</code> will return <code>handler1</code>’s value, as that handler was indicated
|
||||
“more important” than the second handler. The same rule applies when querying for the <code>metadata</code> property of the
|
||||
multiplex log handler - it constructs <code>Metadata</code> uniquing values.</p>
|
||||
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L920-L991">Show on GitHub</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging19MultiplexLogHandlerVyACSayAA0cD0_pGcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging19MultiplexLogHandlerVyACSayAA0cD0_pGcfc">init(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Create a <code>MultiplexLogHandler</code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">_</span> <span class="nv">handlers</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Protocols/LogHandler.html">LogHandler</a></span><span class="p">])</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>handlers</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>An array of <code><a href="../Protocols/LogHandler.html">LogHandler</a></code>s, each of which will receive the log messages sent to this <code><a href="../Structs/Logger.html">Logger</a></code>.
|
||||
The array must not be empty.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L929-L933">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp"></a>
|
||||
<a name="//apple_ref/swift/Property/logLevel" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp">logLevel</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">logLevel</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L935-L943">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP3log5level7message8metadata6source4file8function4lineyAA6LoggerV5LevelO_AM7MessageVSDySSAM13MetadataValueOGSgS3SSutF"></a>
|
||||
<a name="//apple_ref/swift/Method/log(level:message:metadata:source:file:function:line:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP3log5level7message8metadata6source4file8function4lineyAA6LoggerV5LevelO_AM7MessageVSDySSAM13MetadataValueOGSgS3SSutF">log(level:<wbr>message:<wbr>metadata:<wbr>source:<wbr>file:<wbr>function:<wbr>line:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">log</span><span class="p">(</span><span class="nv">level</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span><span class="p">,</span>
|
||||
<span class="nv">message</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Message</span><span class="p">,</span>
|
||||
<span class="nv">metadata</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span><span class="p">?,</span>
|
||||
<span class="nv">source</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">file</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">function</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">line</span><span class="p">:</span> <span class="kt">UInt</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L945-L955">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP8metadataSDySSAA6LoggerV13MetadataValueOGvp"></a>
|
||||
<a name="//apple_ref/swift/Property/metadata" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP8metadataSDySSAA6LoggerV13MetadataValueOGvp">metadata</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">metadata</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L957-L970">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP11metadataKeyAA6LoggerV13MetadataValueOSgSS_tcip"></a>
|
||||
<a name="//apple_ref/swift/Method/subscript(metadataKey:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP11metadataKeyAA6LoggerV13MetadataValueOSgSS_tcip">subscript(metadataKey:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">subscript</span><span class="p">(</span><span class="n">metadataKey</span> <span class="nv">metadataKey</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span><span class="o">.</span><span class="kt">Key</span><span class="p">)</span> <span class="o">-></span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span><span class="o">.</span><span class="kt">Value</span><span class="p">?</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L972-L984">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2021 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external noopener">SwiftLog team</a>. All rights reserved. (Last updated: 2021-12-17)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,322 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>StreamLogHandler Structure Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../js/jquery.min.js" defer></script>
|
||||
<script src="../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../js/lunr.min.js" defer></script>
|
||||
<script src="../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Struct/StreamLogHandler" class="dashAnchor"></a>
|
||||
|
||||
<a title="StreamLogHandler Structure Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
Logging 1.4.2 Docs
|
||||
</a>
|
||||
(81% documented)
|
||||
</p>
|
||||
|
||||
<div class="header-col--secondary">
|
||||
<form role="search" action="../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="../img/gh.png" alt="GitHub"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="dash-feed://https%3A%2F%2Fapple.github.io%2Fswift-log%2Fdocs%2F1.4.2%2FLogging%2Fdocsets%2FLogging.xml">
|
||||
<img class="header-icon" src="../img/dash.png" alt="Dash"/>
|
||||
Install in Dash
|
||||
</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">Logging Reference</a>
|
||||
<img class="carat" src="../img/carat.png" alt=""/>
|
||||
StreamLogHandler Structure Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SwiftLogNoOpLogHandler.html">SwiftLogNoOpLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>StreamLogHandler</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">StreamLogHandler</span> <span class="p">:</span> <span class="kt"><a href="../Protocols/LogHandler.html">LogHandler</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p><code>StreamLogHandler</code> is a simple implementation of <code><a href="../Protocols/LogHandler.html">LogHandler</a></code> for directing
|
||||
<code><a href="../Structs/Logger.html">Logger</a></code> output to either <code>stderr</code> or <code>stdout</code> via the factory methods.</p>
|
||||
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L1076-L1156">Show on GitHub</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging16StreamLogHandlerV14standardOutput5labelACSS_tFZ"></a>
|
||||
<a name="//apple_ref/swift/Method/standardOutput(label:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging16StreamLogHandlerV14standardOutput5labelACSS_tFZ">standardOutput(label:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Factory that makes a <code>StreamLogHandler</code> to directs its output to <code>stdout</code></p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="nf">standardOutput</span><span class="p">(</span><span class="nv">label</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt">StreamLogHandler</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L1078-L1080">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging16StreamLogHandlerV13standardError5labelACSS_tFZ"></a>
|
||||
<a name="//apple_ref/swift/Method/standardError(label:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging16StreamLogHandlerV13standardError5labelACSS_tFZ">standardError(label:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Factory that makes a <code>StreamLogHandler</code> to directs its output to <code>stderr</code></p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="nf">standardError</span><span class="p">(</span><span class="nv">label</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt">StreamLogHandler</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L1083-L1085">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp"></a>
|
||||
<a name="//apple_ref/swift/Property/logLevel" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp">logLevel</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">logLevel</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L163">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP8metadataSDySSAA6LoggerV13MetadataValueOGvp"></a>
|
||||
<a name="//apple_ref/swift/Property/metadata" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP8metadataSDySSAA6LoggerV13MetadataValueOGvp">metadata</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">metadata</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L1093-L1097">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP11metadataKeyAA6LoggerV13MetadataValueOSgSS_tcip"></a>
|
||||
<a name="//apple_ref/swift/Method/subscript(metadataKey:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP11metadataKeyAA6LoggerV13MetadataValueOSgSS_tcip">subscript(metadataKey:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">subscript</span><span class="p">(</span><span class="n">metadataKey</span> <span class="nv">metadataKey</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span><span class="o">.</span><span class="kt">Value</span><span class="p">?</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L1099-L1106">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP3log5level7message8metadata6source4file8function4lineyAA6LoggerV5LevelO_AM7MessageVSDySSAM13MetadataValueOGSgS3SSutF"></a>
|
||||
<a name="//apple_ref/swift/Method/log(level:message:metadata:source:file:function:line:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP3log5level7message8metadata6source4file8function4lineyAA6LoggerV5LevelO_AM7MessageVSDySSAM13MetadataValueOGSgS3SSutF">log(level:<wbr>message:<wbr>metadata:<wbr>source:<wbr>file:<wbr>function:<wbr>line:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">log</span><span class="p">(</span><span class="nv">level</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span><span class="p">,</span>
|
||||
<span class="nv">message</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Message</span><span class="p">,</span>
|
||||
<span class="nv">metadata</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span><span class="p">?,</span>
|
||||
<span class="nv">source</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">file</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">function</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">line</span><span class="p">:</span> <span class="kt">UInt</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L1114-L1127">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2021 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external noopener">SwiftLog team</a>. All rights reserved. (Last updated: 2021-12-17)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,320 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>SwiftLogNoOpLogHandler Structure Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../js/jquery.min.js" defer></script>
|
||||
<script src="../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../js/lunr.min.js" defer></script>
|
||||
<script src="../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Struct/SwiftLogNoOpLogHandler" class="dashAnchor"></a>
|
||||
|
||||
<a title="SwiftLogNoOpLogHandler Structure Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
Logging 1.4.2 Docs
|
||||
</a>
|
||||
(81% documented)
|
||||
</p>
|
||||
|
||||
<div class="header-col--secondary">
|
||||
<form role="search" action="../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="../img/gh.png" alt="GitHub"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="dash-feed://https%3A%2F%2Fapple.github.io%2Fswift-log%2Fdocs%2F1.4.2%2FLogging%2Fdocsets%2FLogging.xml">
|
||||
<img class="header-icon" src="../img/dash.png" alt="Dash"/>
|
||||
Install in Dash
|
||||
</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">Logging Reference</a>
|
||||
<img class="carat" src="../img/carat.png" alt=""/>
|
||||
SwiftLogNoOpLogHandler Structure Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SwiftLogNoOpLogHandler.html">SwiftLogNoOpLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>SwiftLogNoOpLogHandler</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SwiftLogNoOpLogHandler</span> <span class="p">:</span> <span class="kt"><a href="../Protocols/LogHandler.html">LogHandler</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>No operation LogHandler, used when no logging is required</p>
|
||||
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L1159-L1186">Show on GitHub</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging012SwiftLogNoOpC7HandlerVACycfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init()" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging012SwiftLogNoOpC7HandlerVACycfc">init()</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">()</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging012SwiftLogNoOpC7HandlerVyACSScfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging012SwiftLogNoOpC7HandlerVyACSScfc">init(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP3log5level7message8metadata4file8function4lineyAA6LoggerV5LevelO_AL7MessageVSDySSAL13MetadataValueOGSgS2SSutF"></a>
|
||||
<a name="//apple_ref/swift/Method/log(level:message:metadata:file:function:line:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP3log5level7message8metadata4file8function4lineyAA6LoggerV5LevelO_AL7MessageVSDySSAL13MetadataValueOGSgS2SSutF">log(level:<wbr>message:<wbr>metadata:<wbr>file:<wbr>function:<wbr>line:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">@available</span><span class="p">(</span><span class="o">*</span><span class="p">,</span> <span class="n">deprecated</span><span class="p">,</span> <span class="nv">renamed</span><span class="p">:</span> <span class="s">"log(level:message:metadata:source:file:function:line:﹚"</span><span class="p">)</span>
|
||||
<span class="kd">@inlinable</span>
|
||||
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">log</span><span class="p">(</span><span class="nv">level</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span><span class="p">,</span> <span class="nv">message</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Message</span><span class="p">,</span> <span class="nv">metadata</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span><span class="p">?,</span> <span class="nv">file</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">function</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">line</span><span class="p">:</span> <span class="kt">UInt</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L140">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP11metadataKeyAA6LoggerV13MetadataValueOSgSS_tcip"></a>
|
||||
<a name="//apple_ref/swift/Method/subscript(metadataKey:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP11metadataKeyAA6LoggerV13MetadataValueOSgSS_tcip">subscript(metadataKey:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">@inlinable</span>
|
||||
<span class="kd">public</span> <span class="nf">subscript</span><span class="p">(</span><span class="n">metadataKey</span> <span class="nv">_</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span><span class="o">.</span><span class="kt">Value</span><span class="p">?</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L1166-L1171">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP8metadataSDySSAA6LoggerV13MetadataValueOGvp"></a>
|
||||
<a name="//apple_ref/swift/Property/metadata" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP8metadataSDySSAA6LoggerV13MetadataValueOGvp">metadata</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">@inlinable</span>
|
||||
<span class="kd">public</span> <span class="k">var</span> <span class="nv">metadata</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Metadata</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L1173-L1178">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp"></a>
|
||||
<a name="//apple_ref/swift/Property/logLevel" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:7Logging10LogHandlerP8logLevelAA6LoggerV0E0Ovp">logLevel</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">@inlinable</span>
|
||||
<span class="kd">public</span> <span class="k">var</span> <span class="nv">logLevel</span><span class="p">:</span> <span class="kt"><a href="../Structs/Logger.html">Logger</a></span><span class="o">.</span><span class="kt">Level</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="slightly-smaller">
|
||||
<a href="https://github.com/apple/swift-log/tree/1.4.2/Sources/Logging/Logging.swift#L1180-L1185">Show on GitHub</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2021 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external noopener">SwiftLog team</a>. All rights reserved. (Last updated: 2021-12-17)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,28 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="20">
|
||||
<linearGradient id="b" x2="0" y2="100%">
|
||||
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
||||
<stop offset="1" stop-opacity=".1"/>
|
||||
</linearGradient>
|
||||
<clipPath id="a">
|
||||
<rect width="128" height="20" rx="3" fill="#fff"/>
|
||||
</clipPath>
|
||||
<g clip-path="url(#a)">
|
||||
<path fill="#555" d="M0 0h93v20H0z"/>
|
||||
<path fill="#a4a61d" d="M93 0h35v20H93z"/>
|
||||
<path fill="url(#b)" d="M0 0h128v20H0z"/>
|
||||
</g>
|
||||
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110">
|
||||
<text x="475" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="830">
|
||||
documentation
|
||||
</text>
|
||||
<text x="475" y="140" transform="scale(.1)" textLength="830">
|
||||
documentation
|
||||
</text>
|
||||
<text x="1095" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="250">
|
||||
81%
|
||||
</text>
|
||||
<text x="1095" y="140" transform="scale(.1)" textLength="250">
|
||||
81%
|
||||
</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -1,202 +0,0 @@
|
||||
/*! Jazzy - https://github.com/realm/jazzy
|
||||
* Copyright Realm Inc.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
/* Credit to https://gist.github.com/wataru420/2048287 */
|
||||
.highlight .c {
|
||||
color: #999988;
|
||||
font-style: italic; }
|
||||
|
||||
.highlight .err {
|
||||
color: #a61717;
|
||||
background-color: #e3d2d2; }
|
||||
|
||||
.highlight .k {
|
||||
color: #000000;
|
||||
font-weight: bold; }
|
||||
|
||||
.highlight .o {
|
||||
color: #000000;
|
||||
font-weight: bold; }
|
||||
|
||||
.highlight .cm {
|
||||
color: #999988;
|
||||
font-style: italic; }
|
||||
|
||||
.highlight .cp {
|
||||
color: #999999;
|
||||
font-weight: bold; }
|
||||
|
||||
.highlight .c1 {
|
||||
color: #999988;
|
||||
font-style: italic; }
|
||||
|
||||
.highlight .cs {
|
||||
color: #999999;
|
||||
font-weight: bold;
|
||||
font-style: italic; }
|
||||
|
||||
.highlight .gd {
|
||||
color: #000000;
|
||||
background-color: #ffdddd; }
|
||||
|
||||
.highlight .gd .x {
|
||||
color: #000000;
|
||||
background-color: #ffaaaa; }
|
||||
|
||||
.highlight .ge {
|
||||
color: #000000;
|
||||
font-style: italic; }
|
||||
|
||||
.highlight .gr {
|
||||
color: #aa0000; }
|
||||
|
||||
.highlight .gh {
|
||||
color: #999999; }
|
||||
|
||||
.highlight .gi {
|
||||
color: #000000;
|
||||
background-color: #ddffdd; }
|
||||
|
||||
.highlight .gi .x {
|
||||
color: #000000;
|
||||
background-color: #aaffaa; }
|
||||
|
||||
.highlight .go {
|
||||
color: #888888; }
|
||||
|
||||
.highlight .gp {
|
||||
color: #555555; }
|
||||
|
||||
.highlight .gs {
|
||||
font-weight: bold; }
|
||||
|
||||
.highlight .gu {
|
||||
color: #aaaaaa; }
|
||||
|
||||
.highlight .gt {
|
||||
color: #aa0000; }
|
||||
|
||||
.highlight .kc {
|
||||
color: #000000;
|
||||
font-weight: bold; }
|
||||
|
||||
.highlight .kd {
|
||||
color: #000000;
|
||||
font-weight: bold; }
|
||||
|
||||
.highlight .kp {
|
||||
color: #000000;
|
||||
font-weight: bold; }
|
||||
|
||||
.highlight .kr {
|
||||
color: #000000;
|
||||
font-weight: bold; }
|
||||
|
||||
.highlight .kt {
|
||||
color: #445588; }
|
||||
|
||||
.highlight .m {
|
||||
color: #009999; }
|
||||
|
||||
.highlight .s {
|
||||
color: #d14; }
|
||||
|
||||
.highlight .na {
|
||||
color: #008080; }
|
||||
|
||||
.highlight .nb {
|
||||
color: #0086B3; }
|
||||
|
||||
.highlight .nc {
|
||||
color: #445588;
|
||||
font-weight: bold; }
|
||||
|
||||
.highlight .no {
|
||||
color: #008080; }
|
||||
|
||||
.highlight .ni {
|
||||
color: #800080; }
|
||||
|
||||
.highlight .ne {
|
||||
color: #990000;
|
||||
font-weight: bold; }
|
||||
|
||||
.highlight .nf {
|
||||
color: #990000; }
|
||||
|
||||
.highlight .nn {
|
||||
color: #555555; }
|
||||
|
||||
.highlight .nt {
|
||||
color: #000080; }
|
||||
|
||||
.highlight .nv {
|
||||
color: #008080; }
|
||||
|
||||
.highlight .ow {
|
||||
color: #000000;
|
||||
font-weight: bold; }
|
||||
|
||||
.highlight .w {
|
||||
color: #bbbbbb; }
|
||||
|
||||
.highlight .mf {
|
||||
color: #009999; }
|
||||
|
||||
.highlight .mh {
|
||||
color: #009999; }
|
||||
|
||||
.highlight .mi {
|
||||
color: #009999; }
|
||||
|
||||
.highlight .mo {
|
||||
color: #009999; }
|
||||
|
||||
.highlight .sb {
|
||||
color: #d14; }
|
||||
|
||||
.highlight .sc {
|
||||
color: #d14; }
|
||||
|
||||
.highlight .sd {
|
||||
color: #d14; }
|
||||
|
||||
.highlight .s2 {
|
||||
color: #d14; }
|
||||
|
||||
.highlight .se {
|
||||
color: #d14; }
|
||||
|
||||
.highlight .sh {
|
||||
color: #d14; }
|
||||
|
||||
.highlight .si {
|
||||
color: #d14; }
|
||||
|
||||
.highlight .sx {
|
||||
color: #d14; }
|
||||
|
||||
.highlight .sr {
|
||||
color: #009926; }
|
||||
|
||||
.highlight .s1 {
|
||||
color: #d14; }
|
||||
|
||||
.highlight .ss {
|
||||
color: #990073; }
|
||||
|
||||
.highlight .bp {
|
||||
color: #999999; }
|
||||
|
||||
.highlight .vc {
|
||||
color: #008080; }
|
||||
|
||||
.highlight .vg {
|
||||
color: #008080; }
|
||||
|
||||
.highlight .vi {
|
||||
color: #008080; }
|
||||
|
||||
.highlight .il {
|
||||
color: #009999; }
|
||||
@@ -1,404 +0,0 @@
|
||||
/*! Jazzy - https://github.com/realm/jazzy
|
||||
* Copyright Realm Inc.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
*, *:before, *:after {
|
||||
box-sizing: inherit; }
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
background: #fff;
|
||||
color: #333;
|
||||
font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
letter-spacing: .2px;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
box-sizing: border-box; }
|
||||
|
||||
h1 {
|
||||
font-size: 2rem;
|
||||
font-weight: 700;
|
||||
margin: 1.275em 0 0.6em; }
|
||||
|
||||
h2 {
|
||||
font-size: 1.75rem;
|
||||
font-weight: 700;
|
||||
margin: 1.275em 0 0.3em; }
|
||||
|
||||
h3 {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
margin: 1em 0 0.3em; }
|
||||
|
||||
h4 {
|
||||
font-size: 1.25rem;
|
||||
font-weight: 700;
|
||||
margin: 1.275em 0 0.85em; }
|
||||
|
||||
h5 {
|
||||
font-size: 1rem;
|
||||
font-weight: 700;
|
||||
margin: 1.275em 0 0.85em; }
|
||||
|
||||
h6 {
|
||||
font-size: 1rem;
|
||||
font-weight: 700;
|
||||
margin: 1.275em 0 0.85em;
|
||||
color: #777; }
|
||||
|
||||
p {
|
||||
margin: 0 0 1em; }
|
||||
|
||||
ul, ol {
|
||||
padding: 0 0 0 2em;
|
||||
margin: 0 0 0.85em; }
|
||||
|
||||
blockquote {
|
||||
margin: 0 0 0.85em;
|
||||
padding: 0 15px;
|
||||
color: #858585;
|
||||
border-left: 4px solid #e5e5e5; }
|
||||
|
||||
img {
|
||||
max-width: 100%; }
|
||||
|
||||
a {
|
||||
color: #4183c4;
|
||||
text-decoration: none; }
|
||||
a:hover, a:focus {
|
||||
outline: 0;
|
||||
text-decoration: underline; }
|
||||
a.discouraged {
|
||||
text-decoration: line-through; }
|
||||
a.discouraged:hover, a.discouraged:focus {
|
||||
text-decoration: underline line-through; }
|
||||
|
||||
table {
|
||||
background: #fff;
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
overflow: auto;
|
||||
margin: 0 0 0.85em; }
|
||||
|
||||
tr:nth-child(2n) {
|
||||
background-color: #fbfbfb; }
|
||||
|
||||
th, td {
|
||||
padding: 6px 13px;
|
||||
border: 1px solid #ddd; }
|
||||
|
||||
hr {
|
||||
height: 1px;
|
||||
border: none;
|
||||
background-color: #ddd; }
|
||||
|
||||
pre {
|
||||
margin: 0 0 1.275em;
|
||||
padding: .85em 1em;
|
||||
overflow: auto;
|
||||
background: #f7f7f7;
|
||||
font-size: .85em;
|
||||
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; }
|
||||
|
||||
code {
|
||||
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; }
|
||||
|
||||
.item-container p > code, .item-container li > code, .top-matter p > code, .top-matter li > code {
|
||||
background: #f7f7f7;
|
||||
padding: .2em; }
|
||||
.item-container p > code:before, .item-container p > code:after, .item-container li > code:before, .item-container li > code:after, .top-matter p > code:before, .top-matter p > code:after, .top-matter li > code:before, .top-matter li > code:after {
|
||||
letter-spacing: -.2em;
|
||||
content: "\00a0"; }
|
||||
|
||||
pre code {
|
||||
padding: 0;
|
||||
white-space: pre; }
|
||||
|
||||
.content-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column; }
|
||||
@media (min-width: 768px) {
|
||||
.content-wrapper {
|
||||
flex-direction: row; } }
|
||||
.header {
|
||||
display: flex;
|
||||
padding: 8px;
|
||||
font-size: 0.875em;
|
||||
background: #444;
|
||||
color: #999; }
|
||||
|
||||
.header-col {
|
||||
margin: 0;
|
||||
padding: 0 8px; }
|
||||
|
||||
.header-col--primary {
|
||||
flex: 1; }
|
||||
|
||||
.header-link {
|
||||
color: #fff; }
|
||||
|
||||
.header-icon {
|
||||
padding-right: 2px;
|
||||
vertical-align: -3px;
|
||||
height: 16px; }
|
||||
|
||||
.breadcrumbs {
|
||||
font-size: 0.875em;
|
||||
padding: 8px 16px;
|
||||
margin: 0;
|
||||
background: #fbfbfb;
|
||||
border-bottom: 1px solid #ddd; }
|
||||
|
||||
.carat {
|
||||
height: 10px;
|
||||
margin: 0 5px; }
|
||||
|
||||
.navigation {
|
||||
order: 2; }
|
||||
@media (min-width: 768px) {
|
||||
.navigation {
|
||||
order: 1;
|
||||
width: 25%;
|
||||
max-width: 300px;
|
||||
padding-bottom: 64px;
|
||||
overflow: hidden;
|
||||
word-wrap: normal;
|
||||
background: #fbfbfb;
|
||||
border-right: 1px solid #ddd; } }
|
||||
.nav-groups {
|
||||
list-style-type: none;
|
||||
padding-left: 0; }
|
||||
|
||||
.nav-group-name {
|
||||
border-bottom: 1px solid #ddd;
|
||||
padding: 8px 0 8px 16px; }
|
||||
|
||||
.nav-group-name-link {
|
||||
color: #333; }
|
||||
|
||||
.nav-group-tasks {
|
||||
margin: 8px 0;
|
||||
padding: 0 0 0 8px; }
|
||||
|
||||
.nav-group-task {
|
||||
font-size: 1em;
|
||||
list-style-type: none;
|
||||
white-space: nowrap; }
|
||||
|
||||
.nav-group-task-link {
|
||||
color: #808080; }
|
||||
|
||||
.main-content {
|
||||
order: 1; }
|
||||
@media (min-width: 768px) {
|
||||
.main-content {
|
||||
order: 2;
|
||||
flex: 1;
|
||||
padding-bottom: 60px; } }
|
||||
.section {
|
||||
padding: 0 32px;
|
||||
border-bottom: 1px solid #ddd; }
|
||||
|
||||
.section-content {
|
||||
max-width: 834px;
|
||||
margin: 0 auto;
|
||||
padding: 16px 0; }
|
||||
|
||||
.section-name {
|
||||
color: #666;
|
||||
display: block; }
|
||||
.section-name p {
|
||||
margin-bottom: inherit; }
|
||||
|
||||
.declaration .highlight {
|
||||
overflow-x: initial;
|
||||
padding: 8px 0;
|
||||
margin: 0;
|
||||
background-color: transparent;
|
||||
border: none; }
|
||||
|
||||
.task-group-section {
|
||||
border-top: 1px solid #ddd; }
|
||||
|
||||
.task-group {
|
||||
padding-top: 0px; }
|
||||
|
||||
.task-name-container a[name]:before {
|
||||
content: "";
|
||||
display: block; }
|
||||
|
||||
.section-name-container {
|
||||
position: relative; }
|
||||
.section-name-container .section-name-link {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
margin-bottom: 0; }
|
||||
.section-name-container .section-name {
|
||||
position: relative;
|
||||
pointer-events: none;
|
||||
z-index: 1; }
|
||||
.section-name-container .section-name a {
|
||||
pointer-events: auto; }
|
||||
|
||||
.item-container {
|
||||
padding: 0; }
|
||||
|
||||
.item {
|
||||
padding-top: 8px;
|
||||
width: 100%;
|
||||
list-style-type: none; }
|
||||
.item a[name]:before {
|
||||
content: "";
|
||||
display: block; }
|
||||
.item .token, .item .direct-link {
|
||||
display: inline-block;
|
||||
text-indent: -20px;
|
||||
padding-left: 3px;
|
||||
margin-left: 20px;
|
||||
font-size: 1rem; }
|
||||
.item .declaration-note {
|
||||
font-size: .85em;
|
||||
color: #808080;
|
||||
font-style: italic; }
|
||||
|
||||
.pointer-container {
|
||||
border-bottom: 1px solid #ddd;
|
||||
left: -23px;
|
||||
padding-bottom: 13px;
|
||||
position: relative;
|
||||
width: 110%; }
|
||||
|
||||
.pointer {
|
||||
left: 21px;
|
||||
top: 7px;
|
||||
display: block;
|
||||
position: absolute;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-left: 1px solid #ddd;
|
||||
border-top: 1px solid #ddd;
|
||||
background: #fff;
|
||||
transform: rotate(45deg); }
|
||||
|
||||
.height-container {
|
||||
display: none;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
overflow: hidden; }
|
||||
.height-container .section {
|
||||
background: #fff;
|
||||
border: 1px solid #ddd;
|
||||
border-top-width: 0;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 5px;
|
||||
padding: 8px 16px; }
|
||||
|
||||
.aside, .language {
|
||||
padding: 6px 12px;
|
||||
margin: 12px 0;
|
||||
border-left: 5px solid #dddddd;
|
||||
overflow-y: hidden; }
|
||||
.aside .aside-title, .language .aside-title {
|
||||
font-size: 9px;
|
||||
letter-spacing: 2px;
|
||||
text-transform: uppercase;
|
||||
padding-bottom: 0;
|
||||
margin: 0;
|
||||
color: #aaa;
|
||||
-webkit-user-select: none; }
|
||||
.aside p:last-child, .language p:last-child {
|
||||
margin-bottom: 0; }
|
||||
|
||||
.language {
|
||||
border-left: 5px solid #cde9f4; }
|
||||
.language .aside-title {
|
||||
color: #4183c4; }
|
||||
|
||||
.aside-warning, .aside-deprecated, .aside-unavailable {
|
||||
border-left: 5px solid #ff6666; }
|
||||
.aside-warning .aside-title, .aside-deprecated .aside-title, .aside-unavailable .aside-title {
|
||||
color: #ff0000; }
|
||||
|
||||
.graybox {
|
||||
border-collapse: collapse;
|
||||
width: 100%; }
|
||||
.graybox p {
|
||||
margin: 0;
|
||||
word-break: break-word;
|
||||
min-width: 50px; }
|
||||
.graybox td {
|
||||
border: 1px solid #ddd;
|
||||
padding: 5px 25px 5px 10px;
|
||||
vertical-align: middle; }
|
||||
.graybox tr td:first-of-type {
|
||||
text-align: right;
|
||||
padding: 7px;
|
||||
vertical-align: top;
|
||||
word-break: normal;
|
||||
width: 40px; }
|
||||
|
||||
.slightly-smaller {
|
||||
font-size: 0.9em; }
|
||||
|
||||
.footer {
|
||||
padding: 8px 16px;
|
||||
background: #444;
|
||||
color: #ddd;
|
||||
font-size: 0.8em; }
|
||||
.footer p {
|
||||
margin: 8px 0; }
|
||||
.footer a {
|
||||
color: #fff; }
|
||||
|
||||
html.dash .header, html.dash .breadcrumbs, html.dash .navigation {
|
||||
display: none; }
|
||||
|
||||
html.dash .height-container {
|
||||
display: block; }
|
||||
|
||||
form[role=search] input {
|
||||
font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
line-height: 24px;
|
||||
padding: 0 10px;
|
||||
margin: 0;
|
||||
border: none;
|
||||
border-radius: 1em; }
|
||||
.loading form[role=search] input {
|
||||
background: white url(../img/spinner.gif) center right 4px no-repeat; }
|
||||
|
||||
form[role=search] .tt-menu {
|
||||
margin: 0;
|
||||
min-width: 300px;
|
||||
background: #fbfbfb;
|
||||
color: #333;
|
||||
border: 1px solid #ddd; }
|
||||
|
||||
form[role=search] .tt-highlight {
|
||||
font-weight: bold; }
|
||||
|
||||
form[role=search] .tt-suggestion {
|
||||
font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
padding: 0 8px; }
|
||||
form[role=search] .tt-suggestion span {
|
||||
display: table-cell;
|
||||
white-space: nowrap; }
|
||||
form[role=search] .tt-suggestion .doc-parent-name {
|
||||
width: 100%;
|
||||
text-align: right;
|
||||
font-weight: normal;
|
||||
font-size: 0.9em;
|
||||
padding-left: 16px; }
|
||||
|
||||
form[role=search] .tt-suggestion:hover,
|
||||
form[role=search] .tt-suggestion.tt-cursor {
|
||||
cursor: pointer;
|
||||
background-color: #4183c4;
|
||||
color: #fff; }
|
||||
|
||||
form[role=search] .tt-suggestion:hover .doc-parent-name,
|
||||
form[role=search] .tt-suggestion.tt-cursor .doc-parent-name {
|
||||
color: #fff; }
|
||||
|
Before Width: | Height: | Size: 274 B |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
@@ -1,126 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Logging Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="js/jquery.min.js" defer></script>
|
||||
<script src="js/jazzy.js" defer></script>
|
||||
|
||||
<script src="js/lunr.min.js" defer></script>
|
||||
<script src="js/typeahead.jquery.js" defer></script>
|
||||
<script src="js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<a title="Logging Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="index.html">
|
||||
Logging 1.4.2 Docs
|
||||
</a>
|
||||
(81% documented)
|
||||
</p>
|
||||
|
||||
<div class="header-col--secondary">
|
||||
<form role="search" action="search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/apple/swift-log">
|
||||
<img class="header-icon" src="img/gh.png" alt="GitHub"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="dash-feed://https%3A%2F%2Fapple.github.io%2Fswift-log%2Fdocs%2F1.4.2%2FLogging%2Fdocsets%2FLogging.xml">
|
||||
<img class="header-icon" src="img/dash.png" alt="Dash"/>
|
||||
Install in Dash
|
||||
</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="index.html">Logging Reference</a>
|
||||
<img class="carat" src="img/carat.png" alt=""/>
|
||||
Logging Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/LoggingSystem.html">LoggingSystem</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/LogHandler.html">LogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger.html">Logger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/MetadataValue.html">– MetadataValue</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/Level.html">– Level</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Logger/Message.html">– Message</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/MultiplexLogHandler.html">MultiplexLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/StreamLogHandler.html">StreamLogHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SwiftLogNoOpLogHandler.html">SwiftLogNoOpLogHandler</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
|
||||
<h1 id='swiftlog-docs' class='heading'>SwiftLog Docs</h1>
|
||||
|
||||
<p>SwiftLog is a Swift logging API package.</p>
|
||||
|
||||
<p>To get started with SwiftLog, <a href="../Logging/index.html"><code>import Logging</code></a>. The
|
||||
most important type is <a href="https://apple.github.io/swift-log/docs/current/Logging/Structs/Logger.html"><code><a href="Structs/Logger.html">Logger</a></code></a>
|
||||
which you can use to emit log messages.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2021 <a class="link" href="https://github.com/apple/swift-log" target="_blank" rel="external noopener">SwiftLog team</a>. All rights reserved. (Last updated: 2021-12-17)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,74 +0,0 @@
|
||||
// Jazzy - https://github.com/realm/jazzy
|
||||
// Copyright Realm Inc.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
window.jazzy = {'docset': false}
|
||||
if (typeof window.dash != 'undefined') {
|
||||
document.documentElement.className += ' dash'
|
||||
window.jazzy.docset = true
|
||||
}
|
||||
if (navigator.userAgent.match(/xcode/i)) {
|
||||
document.documentElement.className += ' xcode'
|
||||
window.jazzy.docset = true
|
||||
}
|
||||
|
||||
function toggleItem($link, $content) {
|
||||
var animationDuration = 300;
|
||||
$link.toggleClass('token-open');
|
||||
$content.slideToggle(animationDuration);
|
||||
}
|
||||
|
||||
function itemLinkToContent($link) {
|
||||
return $link.parent().parent().next();
|
||||
}
|
||||
|
||||
// On doc load + hash-change, open any targetted item
|
||||
function openCurrentItemIfClosed() {
|
||||
if (window.jazzy.docset) {
|
||||
return;
|
||||
}
|
||||
var $link = $(`a[name="${location.hash.substring(1)}"]`).nextAll('.token');
|
||||
$content = itemLinkToContent($link);
|
||||
if ($content.is(':hidden')) {
|
||||
toggleItem($link, $content);
|
||||
}
|
||||
}
|
||||
|
||||
$(openCurrentItemIfClosed);
|
||||
$(window).on('hashchange', openCurrentItemIfClosed);
|
||||
|
||||
// On item link ('token') click, toggle its discussion
|
||||
$('.token').on('click', function(event) {
|
||||
if (window.jazzy.docset) {
|
||||
return;
|
||||
}
|
||||
var $link = $(this);
|
||||
toggleItem($link, itemLinkToContent($link));
|
||||
|
||||
// Keeps the document from jumping to the hash.
|
||||
var href = $link.attr('href');
|
||||
if (history.pushState) {
|
||||
history.pushState({}, '', href);
|
||||
} else {
|
||||
location.hash = href;
|
||||
}
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
// Clicks on links to the current, closed, item need to open the item
|
||||
$("a:not('.token')").on('click', function() {
|
||||
if (location == this.href) {
|
||||
openCurrentItemIfClosed();
|
||||
}
|
||||
});
|
||||
|
||||
// KaTeX rendering
|
||||
if ("katex" in window) {
|
||||
$($('.math').each( (_, element) => {
|
||||
katex.render(element.textContent, element, {
|
||||
displayMode: $(element).hasClass('m-block'),
|
||||
throwOnError: false,
|
||||
trust: true
|
||||
});
|
||||
}))
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
// Jazzy - https://github.com/realm/jazzy
|
||||
// Copyright Realm Inc.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
$(function(){
|
||||
var $typeahead = $('[data-typeahead]');
|
||||
var $form = $typeahead.parents('form');
|
||||
var searchURL = $form.attr('action');
|
||||
|
||||
function displayTemplate(result) {
|
||||
return result.name;
|
||||
}
|
||||
|
||||
function suggestionTemplate(result) {
|
||||
var t = '<div class="list-group-item clearfix">';
|
||||
t += '<span class="doc-name">' + result.name + '</span>';
|
||||
if (result.parent_name) {
|
||||
t += '<span class="doc-parent-name label">' + result.parent_name + '</span>';
|
||||
}
|
||||
t += '</div>';
|
||||
return t;
|
||||
}
|
||||
|
||||
$typeahead.one('focus', function() {
|
||||
$form.addClass('loading');
|
||||
|
||||
$.getJSON(searchURL).then(function(searchData) {
|
||||
const searchIndex = lunr(function() {
|
||||
this.ref('url');
|
||||
this.field('name');
|
||||
this.field('abstract');
|
||||
for (const [url, doc] of Object.entries(searchData)) {
|
||||
this.add({url: url, name: doc.name, abstract: doc.abstract});
|
||||
}
|
||||
});
|
||||
|
||||
$typeahead.typeahead(
|
||||
{
|
||||
highlight: true,
|
||||
minLength: 3,
|
||||
autoselect: true
|
||||
},
|
||||
{
|
||||
limit: 10,
|
||||
display: displayTemplate,
|
||||
templates: { suggestion: suggestionTemplate },
|
||||
source: function(query, sync) {
|
||||
const lcSearch = query.toLowerCase();
|
||||
const results = searchIndex.query(function(q) {
|
||||
q.term(lcSearch, { boost: 100 });
|
||||
q.term(lcSearch, {
|
||||
boost: 10,
|
||||
wildcard: lunr.Query.wildcard.TRAILING
|
||||
});
|
||||
}).map(function(result) {
|
||||
var doc = searchData[result.ref];
|
||||
doc.url = result.ref;
|
||||
return doc;
|
||||
});
|
||||
sync(results);
|
||||
}
|
||||
}
|
||||
);
|
||||
$form.removeClass('loading');
|
||||
$typeahead.trigger('focus');
|
||||
});
|
||||
});
|
||||
|
||||
var baseURL = searchURL.slice(0, -"search.json".length);
|
||||
|
||||
$typeahead.on('typeahead:select', function(e, result) {
|
||||
window.location = baseURL + result.url;
|
||||
});
|
||||
});
|
||||
@@ -1,2 +0,0 @@
|
||||
/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.org/license */
|
||||
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.6.0",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0<t&&t-1 in e)}S.fn=S.prototype={jquery:f,constructor:S,length:0,toArray:function(){return s.call(this)},get:function(e){return null==e?s.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=S.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return S.each(this,e)},map:function(n){return this.pushStack(S.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(S.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(S.grep(this,function(e,t){return t%2}))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(0<=n&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:u,sort:t.sort,splice:t.splice},S.extend=S.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||m(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],"__proto__"!==t&&a!==r&&(l&&r&&(S.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||S.isPlainObject(n)?n:{},i=!1,a[t]=S.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},S.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==o.call(e))&&(!(t=r(e))||"function"==typeof(n=v.call(t,"constructor")&&t.constructor)&&a.call(n)===l)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t,n){b(e,{nonce:t&&t.nonce},n)},each:function(e,t){var n,r=0;if(p(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},makeArray:function(e,t){var n=t||[];return null!=e&&(p(Object(e))?S.merge(n,"string"==typeof e?[e]:e):u.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:i.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,a=[];if(p(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&a.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&a.push(i);return g(a)},guid:1,support:y}),"function"==typeof Symbol&&(S.fn[Symbol.iterator]=t[Symbol.iterator]),S.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){n["[object "+t+"]"]=t.toLowerCase()});var d=function(n){var e,d,b,o,i,h,f,g,w,u,l,T,C,a,E,v,s,c,y,S="sizzle"+1*new Date,p=n.document,k=0,r=0,m=ue(),x=ue(),A=ue(),N=ue(),j=function(e,t){return e===t&&(l=!0),0},D={}.hasOwnProperty,t=[],q=t.pop,L=t.push,H=t.push,O=t.slice,P=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},R="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",I="(?:\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",W="\\["+M+"*("+I+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+I+"))|)"+M+"*\\]",F=":("+I+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+W+")*)|.*)\\)|)",B=new RegExp(M+"+","g"),$=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),_=new RegExp("^"+M+"*,"+M+"*"),z=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^Line truncated
|
||||
@@ -1,6 +0,0 @@
|
||||
/**
|
||||
* lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.3.9
|
||||
* Copyright (C) 2020 Oliver Nightingale
|
||||
* @license MIT
|
||||
*/
|
||||
!function(){var e=function(t){var r=new e.Builder;return r.pipeline.add(e.trimmer,e.stopWordFilter,e.stemmer),r.searchPipeline.add(e.stemmer),t.call(r,r),r.build()};e.version="2.3.9",e.utils={},e.utils.warn=function(e){return function(t){e.console&&console.warn&&console.warn(t)}}(this),e.utils.asString=function(e){return void 0===e||null===e?"":e.toString()},e.utils.clone=function(e){if(null===e||void 0===e)return e;for(var t=Object.create(null),r=Object.keys(e),i=0;i<r.length;i++){var n=r[i],s=e[n];if(Array.isArray(s))t[n]=s.slice();else{if("string"!=typeof s&&"number"!=typeof s&&"boolean"!=typeof s)throw new TypeError("clone is not deep and does not support nested objects");t[n]=s}}return t},e.FieldRef=function(e,t,r){this.docRef=e,this.fieldName=t,this._stringValue=r},e.FieldRef.joiner="/",e.FieldRef.fromString=function(t){var r=t.indexOf(e.FieldRef.joiner);if(r===-1)throw"malformed field ref string";var i=t.slice(0,r),n=t.slice(r+1);return new e.FieldRef(n,i,t)},e.FieldRef.prototype.toString=function(){return void 0==this._stringValue&&(this._stringValue=this.fieldName+e.FieldRef.joiner+this.docRef),this._stringValue},e.Set=function(e){if(this.elements=Object.create(null),e){this.length=e.length;for(var t=0;t<this.length;t++)this.elements[e[t]]=!0}else this.length=0},e.Set.complete={intersect:function(e){return e},union:function(){return this},contains:function(){return!0}},e.Set.empty={intersect:function(){return this},union:function(e){return e},contains:function(){return!1}},e.Set.prototype.contains=function(e){return!!this.elements[e]},e.Set.prototype.intersect=function(t){var r,i,n,s=[];if(t===e.Set.complete)return this;if(t===e.Set.empty)return t;this.length<t.length?(r=this,i=t):(r=t,i=this),n=Object.keys(r.elements);for(var o=0;o<n.length;o++){var a=n[o];a in i.elements&&s.push(a)}return new e.Set(s)},e.Set.prototype.union=function(t){return t===e.Set.complete?e.Set.complete:t===e.Set.empty?this:new e.Set(Object.keys(this.elements).concat(Object.keys(t.elements)))},e.idf=function(e,t){var r=0;for(var i in e)"_index"!=i&&(r+=Object.keys(e[i]).length);var n=(t-r+.5)/(r+.5);return Math.log(1+Math.abs(n))},e.Token=function(e,t){this.str=e||"",this.metadata=t||{}},e.Token.prototype.toString=function(){return this.str},e.Token.prototype.update=function(e){return this.str=e(this.str,this.metadata),this},e.Token.prototype.clone=function(t){return t=t||function(e){return e},new e.Token(t(this.str,this.metadata),this.metadata)},e.tokenizer=function(t,r){if(null==t||void 0==t)return[];if(Array.isArray(t))return t.map(function(t){return new e.Token(e.utils.asString(t).toLowerCase(),e.utils.clone(r))});for(var i=t.toString().toLowerCase(),n=i.length,s=[],o=0,a=0;o<=n;o++){var u=i.charAt(o),l=o-a;if(u.match(e.tokenizer.separator)||o==n){if(l>0){var c=e.utils.clone(r)||{};c.position=[a,l],c.index=s.length,s.push(new e.Token(i.slice(a,o),c))}a=o+1}}return s},e.tokenizer.separator=/[\s\-]+/,e.Pipeline=function(){this._stack=[]},e.Pipeline.registeredFunctions=Object.create(null),e.Pipeline.registerFunction=function(t,r){r in this.registeredFunctions&&e.utils.warn("Overwriting existing registered function: "+r),t.label=r,e.Pipeline.registeredFunctions[t.label]=t},e.Pipeline.warnIfFunctionNotRegistered=function(t){var r=t.label&&t.label in this.registeredFunctions;r||e.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",t)},e.Pipeline.load=function(t){var r=new e.Pipeline;return t.forEach(function(t){var i=e.Pipeline.registeredFunctions[t];if(!i)throw new Error("Cannot load unregistered function: "+t);r.add(i)}),r},e.Pipeline.prototype.add=function(){var t=Array.prototype.slice.call(arguments);t.forEach(function(t){e.Pipeline.warnIfFunctionNotRegistered(t),this._stack.push(t)},this)},e.Pipeline.prototype.after=function(t,r){e.Pipeline.warnIfFunctionNotRegistered(r);var i=this._stack.indexOf(t);if(i==-1)throw new Error("Cannot find existingFn");i+=1,this._stack.splice(i,0,r)},e.Pipeline.prototype.before=function(t,r){e.Pipeline.warnIfFunctionNotRegistered(r);var i=this._stack.indexOf(t);if(i==-1)throw new Error("Cannot find existingFn");this._stack.splice(i,0,r)},e.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);t!=-1&&this._stack.splice(t,1)},e.Pipeline.prototype.run=function(e){for(var t=this._stack.length,r=0;r<t;r++){for(var i=this._stack[r],n=[],s=0;s<e.length;s++){var o=i(e[s],s,e);if(null!==o&&void 0!==o&&""!==o)if(Array.isArray(o))for(var a=0;a<o.length;a++)n.push(o[a]);else n.push(o)}e=n}return e},e.Pipeline.prototype.runString=function(t,r){var i=new e.Token(t,r);return this.run([i]).map(function(e){return e.toString()})},e.Pipeline.prototype.reset=function(){this._stack=[]},e.Pipeline.prototype.toJSON=function(){return this._stack.map(function(t){return e.Pipeline.warnIfFunctionNotRegistered(t),t.label})},e.Vector=function(e){this._magnitude=0,this.elements=e||[]},e.Vector.prototype.positionForIndex=function(e){if(0==this.elementLine truncated
|
||||